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 =
'0.5.7'.freeze

Class Method Summary collapse

Class Method Details

.authorized?(controller, action, resource) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
42
43
44
# File 'lib/effective_posts.rb', line 39

def self.authorized?(controller, action, resource)
  if authorization_method.respond_to?(:call) || authorization_method.kind_of?(Symbol)
    raise Effective::AccessDenied.new() unless (controller || self).instance_exec(controller, action, resource, &authorization_method)
  end
  true
end

.permitted_paramsObject



46
47
48
49
50
51
52
# File 'lib/effective_posts.rb', line 46

def self.permitted_params
  @@permitted_params ||= [
    :title, :draft, :category, :published_at, :body, :tags, :extra,
    :start_at, :end_at, :location, :website_name, :website_href,
    (EffectiveAssets.permitted_params if defined?(EffectiveAssets)), roles: []
  ].compact
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



35
36
37
# File 'lib/effective_posts.rb', line 35

def self.setup
  yield self
end