On Thu, Aug 14, 2014 at 4:31 PM, Fernando Aureliano <
[email protected]> wrote:

> Hi!
>
> I'm using the version of that gem
> https://github.com/crowdint/acts_as_shopping_cart for rails 3
>
> I did evething with ythe convetions names. But I'm getting the error Can't
> mass-assign protected attributes: item
>

I see item_id and item_type in your attr_accessbile list below, but not
item.


>
> class ShoppingCartsController < ApplicationController
>
>   before_filter :extract_shopping_cart
>
>   def create
>
>     @product = Video.find(params[:product_id])
>
>     @shopping_cart.add(@product, @product.price)
>
>     redirect_to shopping_cart_path
>
>   end
>
>   def show
>
>
>
> *Heres my model ShoppingCart*
>
> # == Schema Information
> #
> # Table name: shopping_carts
> #
> #  id         :integer          not null, primary key
> #  created_at :datetime         not null
> #  updated_at :datetime         not null
> #
>
> class ShoppingCart < ActiveRecord::Base
> acts_as_shopping_cart
>
>   attr_accessible :price
>
>   #accepts_nested_attributes_for :price
> end
>
>
>
> *and the model ShoppingCartItem*
>
> # == Schema Information
> #
> # Table name: shopping_cart_items
> #
> #  id         :integer          not null, primary key
> #  owner_id   :integer
> #  owner_type :string(255)
> #  quantity   :integer
> #  item_id    :integer
> #  item_type  :string(255)
> #  price      :float
> #  created_at :datetime         not null
> #  updated_at :datetime         not null
> #
>
> class ShoppingCartItem < ActiveRecord::Base
>   attr_accessible :owner_id, :owner_type, :quantity, :item_id, :item_type,
> :price
>   acts_as_shopping_cart_item
> end
>
>
> Someone saw something that I'm not seeing?
>
> Thanks!
>
>
>
>
>
>
>
>
>
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/28176fb2-9c7a-4807-b7d4-cc8d4460136b%40googlegroups.com
> <https://groups.google.com/d/msgid/rubyonrails-talk/28176fb2-9c7a-4807-b7d4-cc8d4460136b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAHUC_t_imCPh7Y5CH%3Dn74DZNVftWVMhgWnYkyAs7E0OOfTBS%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to