Class: Identity::InstallGenerator
- Inherits:
-
ActiveRecord::Generators::DeviseGenerator
- Object
- ActiveRecord::Generators::DeviseGenerator
- Identity::InstallGenerator
- Defined in:
- lib/generators/identity/install_generator.rb
Instance Method Summary collapse
- #config_file ⇒ Object
- #json? ⇒ Boolean
- #json_column ⇒ Object
- #migration_data ⇒ Object
- #model_contents ⇒ Object
Instance Method Details
#config_file ⇒ Object
6 7 8 |
# File 'lib/generators/identity/install_generator.rb', line 6 def config_file template "identity.rb", "config/initializers/identity.rb" end |
#json? ⇒ Boolean
57 58 59 |
# File 'lib/generators/identity/install_generator.rb', line 57 def json? rails4? && postgresql? end |
#json_column ⇒ Object
53 54 55 |
# File 'lib/generators/identity/install_generator.rb', line 53 def json_column "%-6s" % (json? ? "json" : "text") end |
#migration_data ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/generators/identity/install_generator.rb', line 17 def migration_data " # To enable/disable users from admin area\n t.boolean :active, null: false, default: true\n\n ## Database authenticatable\n t.string :email, null: false, default: \"\"\n t.string :encrypted_password, null: false, default: \"\"\n\n ## Recoverable\n t.string :reset_password_token\n t.datetime :reset_password_sent_at\n\n ## Rememberable\n t.datetime :remember_created_at\n\n ## Trackable\n t.integer :sign_in_count, default: 0, null: false\n t.datetime :current_sign_in_at\n t.datetime :last_sign_in_at\n t.\#{ip_column} :current_sign_in_ip\n t.\#{ip_column} :last_sign_in_ip\n\n ## Confirmable\n t.string :confirmation_token\n t.datetime :confirmed_at\n t.datetime :confirmation_sent_at\n t.string :unconfirmed_email # Only if using reconfirmable\n\n ## Omniauthable\n t.string :provider\n t.string :uid\n t.\#{json_column} :oauth_hash\n" end |
#model_contents ⇒ Object
10 11 12 13 14 15 |
# File 'lib/generators/identity/install_generator.rb', line 10 def model_contents " include Identity::Mixins::User\n \#{\"serialize :oauth_hash, JSON\" unless json?}\n" end |