This is a really strange error. It only happens while running in
development mode, even if I use the same db. I’m using edge rails. Any
ideas? The user model comes from model_security. The product model
only contains the belongs_to statement.
ActiveRecord::AssociationTypeMismatch in AdminController#create
Product expected, got Product
here’s the action…
def create
@user = User.current
@product = Product.new(params[:product])
if @user.products << @product
flash[:notice] = ‘Product was successfully created.’
redirect_to :action => ‘index’
else
render :action => ‘new’
end
end
#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:148:in
raise_on_type_mismatch' #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:24:in
<<’
#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:23:in
<<' #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in
transaction’
#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/transactions.rb:95:in
transaction' #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/transactions.rb:121:in
transaction’
#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:22:in
<<' #{RAILS_ROOT}/app/controllers/admin_controller.rb:22:in
create’
/usr/local/bin/mongrel_rails:18