Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 23rd, 2012  |  syntax: None  |  size: 0.38 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. What is the best way to bypass devise authorization for a specific record marked public
  2. GET /events/:id
  3.        
  4. skip_before_filter :authenticate_user!, :only => :show, :if => lambda {
  5.     if params[:id]
  6.       @event = Event.find(params[:id])
  7.       @event and @event.public?
  8.     else
  9.       false
  10.     end
  11.   }
  12.        
  13. can :read, Event do |e|
  14.   some_other_authorization_boolean || e.public?
  15. end