Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #routes.rb
- resources :topics do | topic |
- resources :notes
- end
- #controller
- def new
- @topic = Topic.first(:id => params[:topic.id])
- @note = Note.new
- render @note
- end
- #view
- %h1
- New Note :
- %p
- =form_for(@note, :action => resource(@topic,:notes)) do
- %p
- = text_field :title, :label => "Title"
- %p
- Note Details
- %br/
- =text_area :body, :rows => 15, :cols => 60
- %p
- = submit "Create"
- %p
- = link_to 'Back', resource(@topic)
Add Comment
Please, Sign In to add comment