Class: ActionDispatch::Routing::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/bento/rails/routes.rb

Instance Method Summary collapse

Instance Method Details

#bento_for(*resource_names, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/bento/rails/routes.rb', line 3

def bento_for(*resource_names, &block)
  options = resource_names.extract_options!
  resource_names.map!(&:to_sym)

  resource_names.each do |resource_name|
    Bento::Controllers::Helpers.define_helpers(resource_name)
    Bento::Controllers::AccountScopable.define_methods(resource_name)
    resource_options = { :controller => (resource_name) }.merge(options)

    resources(resource_name, resource_options) do
      collection { get :sign_up }
      yield if block_given?
    end
  end
end