Sha256: b33b924d3d120bd73e14a46fb4a6cc8b59e652171de00873b846250cd7ec79b0
Contents?: true
Size: 1.65 KB
Versions: 2
Compression:
Stored size: 1.65 KB
Contents
# Application template recipe for the rails3_devise_wizard. Check for a newer version here: # https://github.com/fortuity/rails3_devise_wizard/blob/master/recipes/add_user_name.rb after_bundler do # Add a 'name' attribute to the User model if recipes.include? 'mongoid' gsub_file 'app/models/user.rb', /end/ do <<-RUBY field :name validates_presence_of :name validates_uniqueness_of :name, :email, :case_sensitive => false attr_accessible :name, :email, :password, :password_confirmation, :remember_me end RUBY end elsif recipes.include? 'mongo_mapper' # Using MongoMapper? Create an issue, suggest some code, and I'll add it elsif recipes.include? 'active_record' gsub_file 'app/models/user.rb', /end/ do <<-RUBY validates_presence_of :name validates_uniqueness_of :name, :email, :case_sensitive => false attr_accessible :name, :email, :password, :password_confirmation, :remember_me end RUBY end else # Placeholder for some other ORM end if recipes.include? 'devise' # install versions of modified Devise views inside 'app/views/devise/registrations' do get 'https://github.com/fortuity/rails3-application-templates/raw/master/files/rails3-mongoid-devise/app/views/devise/registrations/edit.html.erb', 'edit.html.erb' get 'https://github.com/fortuity/rails3-application-templates/raw/master/files/rails3-mongoid-devise/app/views/devise/registrations/new.html.erb', 'new.html.erb' end end end __END__ name: AddUserName description: "Modify the default Devise configuration to add a 'name' attribute for all users." author: fortuity requires: [devise] category: other tags: [utilities, configuration]
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails3_devise_wizard-0.2.3 | recipes/add_user_name.rb |
rails3_devise_wizard-0.2.2 | recipes/add_user_name.rb |