rails g new controller index p 1Ans: The word new should not be here and there should not be a space between p and 1 because actions cannot contain spaces. The scaffold software will think that the actions are index, p, and 1, but 1 is not a legal name for an action. The controller name is also missing between "controller" and "index".
Student GroceryItem Box Story Person Ans: students grocery_item boxes stories people
rails new scaffold generate People name:int gender:Text class:StringAns: The word new should be omitted; the words scaffold and generate should be reversed. Optionally, you can abbreviate generate to g. The model name People should be singular (Person), int should be string, text should be string and lower case because the gender is only one letter. Even if you want to use an integer, spell out the datatype as "integer", not "int". class is a reserved word, so use another word like course instead, string should be lower case.
rake db:migratedo?
<%= render 'page' %>Ans: _page.html.erb
rails dbconsole
<%= yield %>for the layout page to work.
<%= f.date_select :movie_release_date %>to
<%= f.date_select :movie_release_date, :start_year => 1990, :end_year => 2012 %>
validates :username, :presence => true
validates :password, :length => { :in => 8..20 }
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 %>
rails server --port=5000
http://localhost:5000/grocery_items
rails server --port=80then the page can be viewed without specifying a port number:
http://localhost/grocery_items
display1.htm?txtName=Alice&txtGender=F&txtAge=29
map.resources :items