title: How to resolve "ActiveModel::ForbiddenAttributesError" Error
body: <p>I got the following error when I clicked on the "Create user" button.</p>
  
  <pre><code>Error:
  ActiveModel::ForbiddenAttributesError
  
  Extracted source (around line #27):
  25  # POST /users.json
  26  def create
  27   @user = User.new(params[:user])
  28   respond_to do |format|
  29    if @user.save
  </code></pre>
  
  <p>I am following the below reference link and typed same command and same code given.
  <a href="http://railscasts.com/episodes/206-action-mailer-in-rails-3?view=asciicast" rel="nofollow">http://railscasts.com/episodes/206-action-mailer-in-rails-3?view=asciicast</a></p>
  
  <p>My code snippets are described below.</p>
  
  <p>In app/controller/user_controller.rb</p>
  
  <pre><code>  class UsersController &lt; ApplicationController
    before_action :set_user, only: [:show, :edit, :update, :destroy]
  
    # GET /users
    # GET /users.json
    def index
      @users = User.all
    end
  
    # GET /users/1
    # GET /users/1.json
    def show
    end
  
    # GET /users/new
    def new
      @user = User.new
    end
  
    # GET /users/1/edit
    def edit
    end
  
    # POST /users
    # POST /users.json
    def create
     @user = User.new(params[:user])
  
    respond_to do |format|
      if @user.save
        UserMailer.registration_confirmation(@user).deliver
        format.html { redirect_to(@user, :notice =&gt; 'User was successfully created.') }
        format.xml  { render :xml =&gt; @user, :status =&gt; :created, :location =&gt; @user }
      else
        format.html { render :action =&gt; "new" }
        format.xml  { render :xml =&gt; @user.errors, :status =&gt; :unprocessable_entity }
      end
    end
    end
  
    # PATCH/PUT /users/1
    # PATCH/PUT /users/1.json
    def update
      respond_to do |format|
        if @user.update(user_params)
          format.html { redirect_to @user, notice: 'User was successfully updated.' }
          format.json { render :show, status: :ok, location: @user }
        else
          format.html { render :edit }
          format.json { render json: @user.errors, status: :unprocessable_entity }
        end
      end
    end
  
    # DELETE /users/1
    # DELETE /users/1.json
    def destroy
      @user.destroy
      respond_to do |format|
        format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }
        format.json { head :no_content }
      end
    end
  
    private
      # Use callbacks to share common setup or constraints between actions.
      def set_user
        @user = User.find(params[:id])
      end
  
      # Never trust parameters from the scary internet, only allow the white list through.
      def user_params
        params.require(:user).permit(:name, :email)
      end
  end
  </code></pre>
  
  <p>In config/initializer/setup_mail.rb</p>
  
  <pre><code>ActionMailer::Base.smtp_settings = {
    :address              =&gt; "smtp.gmail.com",
    :port                 =&gt; 587,
    :domain               =&gt; "gmail.com",
    :user_name            =&gt; "w5call.w5rtc@gmail.com",
    :password             =&gt; "w5rtc123@",
    :authentication       =&gt; "plain",
    :enable_starttls_auto =&gt; true
  }
  </code></pre>
  
  <p>In app/mailer/user_mailer.rb</p>
  
  <pre><code> class UserMailer &lt; ActionMailer::Base
    default :from =&gt; "w5call.w5rtc@gmail.com"
    def registration_confirmation(user)
      mail(:to =&gt; user.email, :subject =&gt; "Registered", :from =&gt; "w5call.w5rtc@gmail.com")
    end
  end
  </code></pre>
  
  <p>app\views\user_mailer\registration_confirmation.text.erb</p>
  
  <pre><code>&lt;%= @user.name %&gt;,
  Thank you for registering!
  </code></pre>
  
  <p>Please help me for resolve this error as i am totaly new to ROR. Thanks in Advance.</p>