On 18 November 2011 10:10, gbolahan a. <[email protected]> wrote:
> ActiveRecord::AssociationTypeMismatch in ClistingsController#create
>
> Category(#-612714068) expected, got String(#-607696388)
>
> Rails.root: /home/gbolahan/sites/spotvilla
> Application Trace | Framework Trace | Full Trace
>
> app/controllers/clistings_controller.rb:45:in `new'
> app/controllers/clistings_controller.rb:45:in `create'
>
>
> i have implemented collection select but i intend to create a new  new
> model with my Clisting model.
> how do i get around this error.

Posting some of the code around clistings_controller.rb line 45 would help.
(although you might find you're doing this:
  clisting.category = params[:clisting][:category]
rather than:
  clisting.category =
Category.find_or_create_by_name(params[:clisting][:category])
or
  clisting.category_id = params[:clisting][:category]
or some other error relating to passing the Category association a
string... assuming your Clisting has an association to Category...)

-- 
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.

Reply via email to