Guest User

Untitled

a guest
Apr 19th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. Posts controller...
  2. ...
  3. #I want to allow only the post owner to be able to view "show" their own post(s)
  4.  
  5. ...
  6.  
  7. # I would do this though
  8. def show
  9. @post = current_user.posts.find(params[:id])
  10. respond_to do |format|
  11. format.html # show.html.erb
  12. format.xml { render :xml => @post }
  13. end
  14. end
  15.  
  16. ... other basic crud methods
  17.  
  18. ...
Add Comment
Please, Sign In to add comment