Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok, I have found the problem. </p> <p>First of all, I assume you are using Rails 4. The reason you are getting this error is that <code>attr_protected</code> and <code>attr_accessible</code> have been removed from Rails 4 and placed in their own gem. Rails is now encouraging a new protection model. You can read about this in the <a href="https://github.com/rails/strong_parameters" rel="noreferrer">README</a>. If you would like to continue using the old behavior, you must include the <a href="https://github.com/rails/protected_attributes" rel="noreferrer">protected_attributes gem</a>. Hope that helps.</p> <p>EDIT: I've added clarification below since this is likely to be a common problem with users to upgrading to rails 4.</p> <p>If you would like to continue using <code>attr_accessible</code>, i.e. the Rails 3 way, simply add <code>gem protected_attributes</code> to your Gemfile. </p> <p>If you would like to start doing things the Rails 4 way, you must no longer use <code>attr_accessible</code>. Instead, you must move the attribute permission logic into the controller. Here is an example:</p> <pre><code>class UsersController &lt; ApplicationController def create # Using params[:user] without calling user_params will throw an error because # the parameters were not filtered. This is just some Rails magic. @user = User.new user_params if @user.save # Do whatever else render action: :new end end private def user_params # params.require(:user) throws an error if params[:user] is nil if current_user.nil? # Guest # Remove all keys from params[:user] except :name, :email, :password, and :password_confirmation params.require(:user).permit :name, :email, :password, :password_confirmation elsif current_user.has_role :admin params.require(:user).permit! # Allow all user parameters elsif current_user.has_role :user params.require(:user).permit :name, :email, :password, :password_confirmation end end </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload