routes.rb:

map.resources :properties, :has_many => :notes

view:

<%= link_to 'New note', new_property_note_path(@property) %>

or however you're holding the property in the view, if not
@property...

'rake routes' for more

-eric

On Nov 17, 2:23 pm, "Todd A. Jacobs" <tjacobs-sndr-
b4f...@codegnome.org> wrote:
> On Tue, Nov 17, 2009 at 01:40:25PM -0800, Eric wrote:
> > notes_controller:
> > def create @note =
> > Property.find(params[:id]).notes.create(params[:note]) ... end
>
> I'm not sure I'm following this. If I follow a link from a property
> view:
>
>     <%= link_to 'New note', new_note_path %>
>
> how is Property.find(params[:id]).notes.create(params[:note]) going to
> find @Property? I don't really understand how that's getting passed
> along via params here.
>
> --
> "Oh, look: rocks!"
>         -- Doctor Who, "Destiny of the Daleks"

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=.


Reply via email to