Sha256: bad225993b09ab250550d4e6af24835864ac34481e76f991590a35d6d63db020

Contents?: true

Size: 776 Bytes

Versions: 2

Compression:

Stored size: 776 Bytes

Contents

# add username to users
inject_into_file "app/models/user.rb", after: "# username\n" do
<<-EOF
  alias_attribute :name, :username
EOF
end

generate "migration", "add_username_to_users", "username:string:index"
rake "db:migrate"

gsub_file "app/views/devise/sessions/new.html.erb", ":email", ":username"

[
  "app/views/devise/registrations/new.html.erb",
  "app/views/devise/registrations/edit.html.erb",
].each do |file|
  inject_into_file file, after: "<%= devise_error_messages! %>\n" do
<<-EOF
    <div class="form-group">
      <%= f.label :username %>
      <%= f.text_field :username, class: 'form-control' %>
    </div>
EOF
  end
end

gsub_file "config/initializers/devise.rb", "# config.authentication_keys = [ :email ]", "config.authentication_keys = [ :username ]"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crosstie-0.0.3 lib/crosstie/templates/user.rb
crosstie-0.0.2 lib/crosstie/templates/user.rb