Module: Faalis::Dashboard::Sections::Resource::ClassMethods

Defined in:
lib/faalis/dashboard/sections/resource.rb

Overview

The actual DSL for resource ages

Instance Method Summary collapse

Instance Method Details

#engine(name) ⇒ Object

Set the engine name of current controller. It’s necessary to provide and engine name if the controller belongs to an engine other than Faalis or Rails.application.



209
210
211
212
213
# File 'lib/faalis/dashboard/sections/resource.rb', line 209

def engine(name)
  define_method(:_engine) do
    name.constantize
  end
end

#route_engine(name = nil, &block) ⇒ Object

Via this method user can specify the engine or application name which current resource is defined under. Default value is: Rails.application



189
190
191
192
193
194
195
# File 'lib/faalis/dashboard/sections/resource.rb', line 189

def route_engine(name = nil, &block)
  define_method(:_route_engine) do
    return block.call if block_given?
    return name unless name.nil?
    fail 'You have to provide a name or a block'
  end
end

#route_scope(name, &block) ⇒ Object

Via this method user can specify the name of current resource scope, Default value is dashboard



199
200
201
202
203
204
# File 'lib/faalis/dashboard/sections/resource.rb', line 199

def route_scope(name, &block)
  define_method(:_route_scope) do
    return block.call if block_given?
    name
  end
end