title: RoR: Controller Submit with params
body: <p>I'm writing an entry submission controller by this tutorial: <a href="http://www.communityguides.eu/articles/1" rel="nofollow">http://www.communityguides.eu/articles/1</a></p>
  
  <p>When I try to submit an entry, I get <code>Users can't be blank</code>...I don't want to pass the user_id in as a hidden field, right? So how should I change this to automatically get the user's id?</p>
  
  <p>I'm using devise for authentication. :) And I'm a complete rails novice.
  This is my controller: </p>
  
  <pre><code>    def submit
        @entry = current_user.articles.find(params[:id])
  
        # submit only, if article is currently in draft or rejected-state
        if (@entry.state == 0) or (@article.state == 2)
          @entry.state = 1
          @entry.submitted = Time.now
  
          if @entry.save
            flash[:notice] = 'Your article was successfully submitted for approval.'
          else
            flash[:error] = 'There was an error while submitting your article.'   
          end           
        else
          flash[:error] = 'This article can not be submitted.'  
        end
  
        respond_to do |format|
          format.html { redirect_to(:action =&gt; 'myarticles') }
          format.xml  { head :ok }
        end
      end
    # GET /entries/1/edit
    def edit
      @entry = Entry.find(params[:id])
    end
  
    # POST /entries
    # POST /entries.xml
    def create
      @entry = Entry.new(params[:entry])
  
      respond_to do |format|
        if @entry.save
          format.html { redirect_to(@entry, :notice =&gt; 'Entry was successfully created.') }
          format.xml  { render :xml =&gt; @entry, :status =&gt; :created, :location =&gt; @entry }
        else
          format.html { render :action =&gt; "new" }
          format.xml  { render :xml =&gt; @entry.errors, :status =&gt; :unprocessable_entity }
        end
      end
    end
  
    # PUT /entries/1
    # PUT /entries/1.xml
    def update
      @entry = current_user.entries.find(params[:id])
  
          #if the entry has been approved, the user cannot change the title or URL.
          if @entry.state &gt; 2
              params[:entry].delete(:title)
              params[:entry].delete(:url)
          end
      respond_to do |format|
        if @entry.update_attributes(params[:entry])
          format.html { redirect_to(@entry, :notice =&gt; 'Entry was successfully updated.') }
          format.xml  { head :ok }
        else
          format.html { render :action =&gt; "edit" }
          format.xml  { render :xml =&gt; @entry.errors, :status =&gt; :unprocessable_entity }
        end
      end
    end
  </code></pre>