Module: Devise::CustomizeMessage

Defined in:
lib/generators/devise/customize/customize_messages.rb

Class Method Summary collapse

Class Method Details

.find_recordObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/generators/devise/customize/customize_messages.rb', line 23

def find_record  
      say %Q{Currently Cream only supports generic login strategy for :active_record and :mongoid.
  Please help add a strategy for your ORM of choice by adding a FindRecord#[name of your orm] method to the Cream 'app_generator.rb' file.

  How: Add a self#[orm]_find_record method in your User class, make it work, then submit it as a patch to Cream. It should be very simple :)

  The example for mongoid:
    ...
    module FindRecord
def self.mongoid 
  #{FindRecord.mongoid}
end
    end

  See: https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign_in-using-their-username-or-email-address for how to do it!}, :yellow  
end

.locales_updateObject



40
41
42
43
44
45
46
47
48
49
# File 'lib/generators/devise/customize/customize_messages.rb', line 40

def locales_update
  say %q{
Modify config/locales/en.yml to contain something like:

activemodel:
  attributes:
    user:
login: "Username or email"
  }, :green
end

.retrieve_passwordObject



17
18
19
20
21
# File 'lib/generators/devise/customize/customize_messages.rb', line 17

def retrieve_password        
    say %q{Currently Cream only supports a username/password retrieval strategy for :active_record and :mongoid
Please help add a strategy for your ORM of choice by adding a FindRecord.#[orm] method to the Cream 'app_generator.rb' file. Thanks!
See: https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign_in-using-their-username-or-email-address for how to do it!}, :yellow
end

.say(msg, options = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/generators/devise/customize/customize_messages.rb', line 6

def say msg, options = nil
  options = case options
  when Symbol
    {:color => options}
  when Hash
    option          
  end
  puts msg.colorize(options) if options
  puts msg if !options          
end