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.



212
213
214
215
216
# File 'lib/faalis/dashboard/sections/resource.rb', line 212

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



192
193
194
195
196
197
198
# File 'lib/faalis/dashboard/sections/resource.rb', line 192

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



202
203
204
205
206
207
# File 'lib/faalis/dashboard/sections/resource.rb', line 202

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