Rails schema scaffolding -


i have 1 project school , little bit confused how make tag , category asociated posts when looking tips in google found thread. tried scaffolding described , working fine, when ran server , tried create new post appeared:

activemodel::massassignmentsecurity::error in postscontroller#create

can't mass-assign protected attributes: category, user

so don't know wrong can use help. or maybe there can suggested way, mabe simpler how scaffold posts tags , categories.

thank much

here models:

class post < activerecord::base   belongs_to :category   belongs_to :user   attr_accessible :body, :title, :category, :user end  class category < activerecord::base   attr_accessible :name end  class serie < activerecord::base   attr_accessible :name, :website end  class tag < activerecord::base   attr_accessible :name end  class tagsserie < activerecord::base   belongs_to :serie   belongs_to :tag   # attr_accessible :title, :body end  class tagspost < activerecord::base   belongs_to :post   belongs_to :tag   # attr_accessible :title, :body end  class user < activerecord::base   attr_accessible :email, :password end 

add attr_accessible in post model:

class post < activerecord::base   attr_accessible :category_id, :user_id, :other_attributes_from_post_model end 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -