title: how to only edit and destroy my own content only?
body: <p>Have a basic blog (it's actually edgeguide's blog: <a href="http://edgeguides.rubyonrails.org/getting_started.html" rel="nofollow">http://edgeguides.rubyonrails.org/getting_started.html</a>)</p>
  
  <p>Then I integrated Devise into it. So, user can only log in and see their own information.</p>
  
  <p>Now trying to change it somewhat. </p>
  
  <p>I'd like the users to see all content, but <strong>only edit and destroy</strong> their own only. </p>
  
  <p>Trying to use <code>before_action</code> filter like this: </p>
  
  <pre><code> `before_action :authorize, :only =&gt; [:edit, :destroy]`
  </code></pre>
  
  <p>And this is the authorize method that I wrote: </p>
  
  <pre><code>     def authorize
         @article = Article.find(params[:id])
          if !@article.user_id = current_user.id then 
          flash[:notice] = "You are not the creator of this article, therefore you're not permitted to edit or destroy this article"
      end
  end
  </code></pre>
  
  <p>But it doesn't work. Everything acts as normal, and I can delete mine and everyone's else content. </p>
  
  <p>How do I get it that I can destroy ONLY my own content, and not everyone's else? </p>
  
  <p>Not using CanCan, nor do I want to. </p>
  
  <p>Not sure if this is worth including or not, but originally when I had everyone see their own content, that was via create action: </p>
  
  <pre><code>   def create
      @article = Article.new(article_params)
      @article.user_id = current_user.id if current_user
      if @article.save
  
          redirect_to @article
      else
          render 'new'
      end
  end
  </code></pre>