Module: MetaMagic::Helper

Extended by:
ActiveSupport::Concern
Defined in:
lib/meta_magic/helper.rb

Instance Method Summary collapse

Instance Method Details

#object_path(object, params = {}) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/meta_magic/helper.rb', line 7

def object_path(object, params = {})
  action = params.delete(:action) || :show

  send("#{ "#{ action }_" unless action == :show }"\
       "#{ object.class.name.underscore }"\
       "_path", object, params)
end

#objects_path(object, params = {}) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/meta_magic/helper.rb', line 15

def objects_path(object, params = {})
  action = params.delete(:action) || :index

  send("#{ "#{ action }_" unless action == :index }"\
       "#{ object.class.name.pluralize.underscore }"\
       "_path", params)
end