title: create action in rails
body: <p>When i use scaffold in rails , controller creates various methods like </p>
  
  <blockquote>
    <p>new,create,show,index etc</p>
  </blockquote>
  
  <p>but here i can't understand transition of new action to create action</p>
  
  <p>eg. when i click on new Post it look up for new action,now it render _form,but when at time of submit how data entered to that particular table, <strong>where the create action of controller called and how ?</strong></p>
  
  <p><strong>My posts_controller</strong> is as </p>
  
  <pre><code>def new
  @post = Post.new
  @post.user_id = current_user.id
  @post.save
  respond_to do |format|
    format.html # new.html.erb
    format.json { render json: @post }
  end
  end
  
  # GET /posts/1/edit
  def edit
  @post = Post.find(params[:id])
  authorize! :manage, @post
  end
  
  # POST /posts
  # POST /posts.json
  def create
  @post = Post.new(params[:post])
  
  respond_to do |format|
    if @post.save
      format.html { redirect_to @post, notice: 'Post was successfully created.' }
      format.json { render json: @post, status: :created, location: @post }
    else
      format.html { render action: "new" }
      format.json { render json: @post.errors, status: :unprocessable_entity }
    end
  end
  end
  </code></pre>