Click here to Skip to main content
15,893,722 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
CSS
I am new on rails. Below is what i am trying

class Category < ActiveRecord::Base
    attr_accessible :name
    has_many :post
end

class Post < ActiveRecord::Base
	attr_accessible :title, :body, :category_id, :author_id
	belongs_to :category
end


but i am not sure how to use attr_accessible in rails 4+ in my above scnerio . I was doing as per old .Please suggest


def category_params
params.require(:category).permit(:name)
end
this is i found how to use it , but not sure where to use has many attribute then ?
Posted
Updated 20-May-15 7:35am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900