print rand(11)
employee_id = 1001 + rand(999) print employee_id, "\n"
hours_worked = 45.0 hourly_salary = 10.0by
print "Enter hours worked: " hours_worked = STDIN.gets.chomp.to_f print "Enter hourly salary: " hourly_salary = STDIN.gets.chomp.to_f
puts "Our consultants can help your company " + verb + " " + adjective + " " + noun + "."with
@sentence = "Our consultants can help your company " + verb + " " + adjective + " " + noun + "."Put this code in the view:
<%= @sentence %>
def display roll1 = 1 + rand(6) roll2 = 1 + rand(6) @die1 = roll1.to_s + ".jpg" @die2 = roll2.to_s + ".jpg" @sum = roll1 + roll2 endand this code in the display view
<p><%= image_tag @die1 image_tag @die1 %></p> <p>The sum of the rolls is <%= @sum %></p>
> rake db:seed
# Return the first record in the table. GroceryItem.first # Return the last record in the table. GroceryItem.last # Return number of rows in table. GroceryItem.count # Get grocery_item with id=3 s = GroceryItem.find(3) # Get grocery_item with code=44444, using dynamic finder method s = GroceryItemStudent.find_by_code(44444) # Get grocery_item with description "Green Beans". s = GroceryItem.find_by_description("Green Beans") # Get all grocery items for which on_sale is true. s = GroceryItem.find_all_by_on_sale(true)
def doubles? if @die1 == @die2 return true else return false end end