title: Create action to change boolean value in Rails 3
body: <p>I have a simple model for suggestions in my Rails 3 application. I am trying to add a simple link_to link on the index view that when clicked marks the suggestion as approved.</p>
  
  <p>So far I have the following code:</p>
  
  <p><strong>routes.rb</strong></p>
  
  <pre><code>resources :suggestions do
   get :approve
  end
  </code></pre>
  
  <p><strong>suggestions_controller.rb</strong></p>
  
  <pre><code>def approve
   @suggestion = Suggestion.find(params[:id])
   @suggestion.update_attribute(:approved, 'true')
   @suggestion.update_attribute(:approved_on, Time.now)
   redirect_to suggestion_path
  end
  </code></pre>
  
  <p><strong>suggestion.rb</strong></p>
  
  <pre><code>attr_accessible :author, :details, :localip, :title, :approved, :approved_on
  </code></pre>
  
  <p><strong>schema.rb</strong></p>
  
  <pre><code>create_table "suggestions", :force =&gt; true do |t|
   t.string   "title"
   t.string   "author"
   t.text     "details"
   t.string   "localip"
   t.datetime "created_at",                     :null =&gt; false
   t.datetime "updated_at",                     :null =&gt; false
   t.boolean  "approved",    :default =&gt; false
   t.datetime "approved_on"
  end
  </code></pre>
  
  <p><strong>index.html.erb (suggestions)</strong></p>
  
  <pre><code>&lt;% if @suggestion.approved? %&gt;
      &lt;%= @suggestion.approved_on %&gt;
  &lt;% else %&gt;
      Not yet approved. (&lt;%= link_to "Approve", approve_suggestion_url(@approve), :method =&gt; :put %&gt;)
  &lt;% end %&gt;
  </code></pre>
  
  <p>When using the above code, I get the following exception error:</p>
  
  <pre><code>undefined method `approved?' for nil:NilClass
  </code></pre>
  
  <p>Am I missing a step out somewhere something?</p>