Module: ToyResources::Methods::ClassMethods

Defined in:
lib/toy-resources/methods.rb

Instance Method Summary collapse

Instance Method Details

#modelObject



32
33
34
# File 'lib/toy-resources/methods.rb', line 32

def model
  to_s.gsub('Controller', '').underscore.singularize.camelize.constantize
end

#resources(*args) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/toy-resources/methods.rb', line 21

def resources *args
  options = args.extract_options!
  actions = {}
  include(singular? ? ToyResources::Singular : ToyResources::Plural)
  nested_to(options[:nested_to])
  actions[:crud] = crud_actions if args.first == :all
  actions[:crud] = crud_actions - options.delete(:except) if options[:except]
  actions[:crud] = options.delete(:only) if options[:only]
  define_actions self, actions, options
end