Class: Merb::Controller

Inherits:
Object
  • Object
show all
Defined in:
lib/merb_component/controller_ext.rb

Defined Under Namespace

Classes: Aggregator

Constant Summary collapse

METHOD_TO_ACTION =
{
  :post => :create,
  :put => :update,
  :delete => :destroy
}.freeze

Instance Method Summary collapse

Instance Method Details

#_abstract_dispatch(*args) ⇒ Object



136
137
138
139
# File 'lib/merb_component/controller_ext.rb', line 136

def _abstract_dispatch(*args)
  _dispatch = Merb::AbstractController.instance_method(:_dispatch)
  _dispatch.bind(self).call(*args)
end

#aggregatorObject



141
142
143
144
# File 'lib/merb_component/controller_ext.rb', line 141

def aggregator
  aggregators = Thread::current[:aggregators] ||= {}
  (aggregators[self.class] ||= []).last
end

#url_with_scope(*args) ⇒ Object Also known as: url



146
147
148
149
150
151
152
153
# File 'lib/merb_component/controller_ext.rb', line 146

def url_with_scope(*args)
  result = url_without_scope(*args)
  if (agg = aggregator) && (key = agg.key)
    resource_without_scope(key) + result
  else
    result
  end
end