On Sep 26, 5:53 am, Jon <[EMAIL PROTECTED]> wrote:
> class ReviewsController < ApplicationController
>
> def create
> @review=Review.new(params[:review])
> @[EMAIL PROTECTED]
> @review.save
> redirect_to '/inventory'
> end
The problem you have is that @album is nil, because you haven't set it
to anything. It may have been set when you rendered the form, but that
was a different instance of the controller (quite possibly in a
different process or even server). You need to have whatever parameter
in the form you need to be able to retrieve that album, (eg a
hidden_field)
Fred
>
> end
>
> i'm not sure that @[EMAIL PROTECTED] is the correct syntax, but even
> at the command line when I instantiate an object of type Review and do
> Review.album.title="GoldDigger", it says that album is an undefined
> method. The only thing I can think of is that I am missing something
> when I set up the associations.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---