hello there all,
i am writing a website in rails, i love it, but i am banging my head
ok, i have a table called sites ( means customer sites )
each site has_many :site_notes
so, site_note belongs_to :site
i used a scaffold to generate the site notes files. site notes work
like comments to a blog.
a customer has sites and for each site, i want him to be able to post
about what what his machines are doing.
so, my link to the sites controller looks like this.
<%= link_to “site notes”, :action => “list”,
:id => @site,
:controller => ‘site_notes’ %>
and in the site_notes_controller.rb i have this
@site = Site.find(params[:id])
@site_notes = SiteNote.find(:all, :conditions => [“site_id”,
@site_note_pages, @site_notes = paginate :site_notes, :per_page =>
everything seems to work, it lists the right notes, i can edit and
but when i try to add a new one, it tells me that it cannot find a Site
without an id.
so, i guess i need to know how to put something either in the model or
controller, (or view, whatever works)
that will automatically add site_id = @site.id when i create a new note