<%= render 'page' %> Ans: _page.html.erb
<%= f.date_select :movie_release_date %>to
<%= f.date_select :movie_release_date, :start_year => 1990, :end_year => 2012 %>
validates :owner, :presence => true
validates :password, :length => { :minimum => 8 }
validates :number_of_guests, :numericality =>
{ :less_than_or_equal_to => 4, :only_integer => true }
rails dbconsole
| CRUD Term | HTTP Command |
|---|---|
| Create | POST |
| Read | GET |
| Update | PUT |
| Destroy | DELETE |
rails server --port=3726
print "Hello, World."
grand_total = 256
get "info/staff"
resources :movie_reviews
| Action | Helper Method that Generates a URL path |
|---|---|
| index | students_path |
| show | student* |
| new | new_student_path |
| edit | edit_student_path |
| destroy | student* |
<%= link_to 'Show', student %>
<%= link_to 'Back', students_path %>
<%= link_to 'New Student', new_student_path %>
<%= link_to 'Edit', edit_student_path(student) %>
<%= link_to 'Destroy', student,
:confirm => 'Are you sure?',
:method => :delete %>
c = 20 f = 9 * c / 5 + 32 puts f
c = 20 @f = 9 * c / 5 + 32This code is placed into the controller method corresponding to the view that will contain the output. Then put this ERB code on the view page:
<%= @f %>
def staff @title = "Staff Page" end
object : class :: cookie :: cookie-cutter
+ insert(Fixnum, String) : String
# Ssmple statements to use in your # test-time.rb file for Project 3. # Create Time object for current time. t = Time.now print t, "\n" # Check if it is daylight savings time. print t.dst?, "\n" # Check the weekday number # (0 == SUN, 1 == MON, 2 == TUE, etc.) print t.wday, "\n" # Find number seconds since Dec. 31, 1969, 18:00:00. print t.to_a, "\n" # Create time object for July 4, 1776, 12 noon: s = Time.new(1776, 7, 4, 12, 0, 0) s.print s, "\n"
# Ssmple statements to use in your # test-student.rb file for Project 3. s1 = Student.new s1.first_name = "Sally" s1.major = "English" s1.year = 2 s1.gpa = 3.87 s1.save s2 = Student.new s2.first_name = "Edward" s2.major = "Art" s2.year = 3 s2.gpa = 3.31 s2.save print Student.count, "\n" print Student.first.first_name, "\n"