title: Rails RESTful controller action to create User
body: <p>I am re-reading <a href="https://www.railstutorial.org/" rel="nofollow">railstutorial</a> the second time for clarity. I was trying to understand <a href="https://www.railstutorial.org/book/sign_up#table-RESTful_users" rel="nofollow">RESTful resources</a> provided by rails where it listed various HTTP request with corresponding controller actions: <em>index, show, new, create, edit, update, destroy.</em> </p>
  
  <p>I never really fully understood how rails controller works and I wanted to clarify it. If I make a <code>users_controller.rb</code> and want to create new user, <em>and that's it</em>. I don't care about redirecting, flash messages, and other flairs. I just want to create new user and save it on my database. </p>
  
  <p>I want to do <code>User.create(name: "Iggy1", email: "letsmail@iggy.com")</code>. Assume I did migration and I have <code>name</code> (string) and <code>email</code> (string) on DB schema.</p>
  
  <p><strong><em>What is the least code line on users_controller.rb needed to create a user?</em></strong></p>
  
  <p>The reason why I ask this question is up til now, I am still not 100% sure which code line actually performs the desired action. Is rails actually smart enough to recognize these specific keywords <code>index</code>, <code>new</code>, <code>create</code>, <code>destroy</code>, <code>show</code>, <code>edit</code>, and <code>update</code>, or are they arbitrary? If rails is smart enough to detect those seven keywords, by merely listing the method (<code>def destroy; #&lt;no code&gt;; end</code>), is DELETE user method automatically accessible, or I  have to actually say <code>def destroy; User.find(params[:id]).destroy; end</code> to use DELETE user method? On <code>users_controller.rb</code>, I have, from railstutorial, in the end, this elaborate code.</p>
  
  <pre><code>...
    def create
      @user = User.new(user_params)
      if @user.save
        @user.send_activation_email
        flash[:info] = "Please check your email to activate your account."
        redirect_to root_url
      else
        render 'new'
      end
    end
  ...
  </code></pre>
  
  <p>Is merely having <code>def create</code> on Users_controller sufficient for rails to create a user?</p>
  
  <pre><code>def create
  end
  </code></pre>
  
  <p>Or I need at least to have <code>User.new</code>, or more codes to create new user?</p>