3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/resourcery/controller_macro.rb', line 3
def serve_resource(klass = nil, opts = {})
@resource_options = {
finder: :find
}.merge(opts)
extend ControllerExtensions::ClassMethods
include ControllerExtensions::Filters
include ControllerExtensions::InstanceMethods
@resource_class = case klass
when Class then klass
when Symbol then klass.to_s.classify.constantize
else name.gsub(/Controller$/, '').singularize.constantize
end
helper_method :resource, :collection
respond_to :html if mimes_for_respond_to.empty?
end
|