Module: Revise::Helpers::Core

Defined in:
lib/revise/helpers/core.rb

Instance Method Summary collapse

Instance Method Details

#revise_for(*resources) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/revise/helpers/core.rb', line 4

def revise_for(*resources)
  Revise.app = self

  options = resources.extract_options!

  resources.each do |resource|
    begin
      if Revise::MODULES.has_key?(resource)
        models = Revise::MODULES[resource]
        models.each do |m|
          model = Revise::Models.const_get(m)
          add_helpers(model)
          add_controllers(model)
          add_mailers(model)
        end
      else
        Padrino.logger.error "Hey man #{resource} doesn't exist"
      end
    rescue Exception => e
      Padrino.logger.error "Failed to load: #{resource} Because #{e.message()}"
    end
  end
end