Attributes for devise generator

This commit is contained in:
Jinzhu
2010-07-17 10:20:07 +08:00
committed by José Valim
parent 55fd7e3b0a
commit aecc014d33
2 changed files with 7 additions and 1 deletions

View File

@@ -4,6 +4,8 @@ require 'generators/devise/orm_helpers'
module ActiveRecord
module Generators
class DeviseGenerator < ActiveRecord::Generators::Base
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
include Devise::Generators::OrmHelpers
source_root File.expand_path("../templates", __FILE__)
@@ -23,4 +25,4 @@ CONTENT
end
end
end
end
end

View File

@@ -10,6 +10,10 @@ class DeviseCreate<%= table_name.camelize %> < ActiveRecord::Migration
# t.lockable :lock_strategy => :<%= Devise.lock_strategy %>, :unlock_strategy => :<%= Devise.unlock_strategy %>
# t.token_authenticatable
<% for attribute in attributes -%>
t.<%= attribute.type %> :<%= attribute.name %>
<% end -%>
t.timestamps
end