Module: EffectivePosts
- Defined in:
- lib/effective_posts.rb,
lib/effective_posts/engine.rb,
lib/effective_posts/version.rb,
lib/generators/effective_posts/install_generator.rb
Defined Under Namespace
Modules: Generators Classes: Engine
Constant Summary collapse
- VERSION =
'1.0.4'.freeze
Class Method Summary collapse
- .authorize!(controller, action, resource) ⇒ Object
- .authorized?(controller, action, resource) ⇒ Boolean
- .permitted_params ⇒ Object
- .setup {|_self| ... } ⇒ Object
Class Method Details
.authorize!(controller, action, resource) ⇒ Object
53 54 55 |
# File 'lib/effective_posts.rb', line 53 def self.(controller, action, resource) raise Effective::AccessDenied.new('Access Denied', action, resource) unless (controller, action, resource) end |
.authorized?(controller, action, resource) ⇒ Boolean
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/effective_posts.rb', line 40 def self.(controller, action, resource) @_exceptions ||= [Effective::AccessDenied, (CanCan::AccessDenied if defined?(CanCan)), (Pundit::NotAuthorizedError if defined?(Pundit))].compact return !! unless .respond_to?(:call) controller = controller.controller if controller.respond_to?(:controller) begin !!(controller || self).instance_exec((controller || self), action, resource, &) rescue *@_exceptions false end end |
.permitted_params ⇒ Object
57 58 59 60 61 62 |
# File 'lib/effective_posts.rb', line 57 def self.permitted_params @@permitted_params ||= [ :title, :excerpt, :description, :draft, :category, :published_at, :body, :tags, :extra, :start_at, :end_at, :location, :website_name, :website_href, roles: [] ].compact end |
.setup {|_self| ... } ⇒ Object
36 37 38 |
# File 'lib/effective_posts.rb', line 36 def self.setup yield self end |