In the controller we also need to apply the accessible option to the create action.
if we just apply it like this then it will not work.
@article = Article.new(params[:article])
@article.accessible = :all if admin?
The reason that this doesn’t work is that the mass assignment happens in the new call so by the time we’ve set accessible it’s too late. We need to separate creating a new Article from assigning its attributes and slip the call to accessible in between the two.
@article = Article.new
@article.accessible = :all if admin?
@article.attributes = params[:article]

How can I include the following code after initialize object using load_and_authorize_resource