Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Build a Simple Ruby on Rails Application Creating an Authentication System Generating the User Model

Josh Vogel
Josh Vogel
741 Points

Is 'profile_name' part of devise?

Let's say in my application I wanted to call it 'username'. Can I only change this on the front end, or can I add t.string :user_name or something similar to the devise_create_users.rb? If profile_name is tied to devise, how can I see a list of available attributes?

1 Answer

Brandon Barrette
Brandon Barrette
20,485 Points

So devise is added to a model. You can decide what you want to put on the model, so no, you don't need to use profile_name. In fact, I don't think Devise even handles profile names, just emails and passwords.

So if you've already created the User model, you can add to it by creating a migration:

rails generate migration add_user_name_to_users

Then you can just add it:

def change
    add_column :users, :username, :string
end

See more here: http://edgeguides.rubyonrails.org/active_record_migrations.html#writing-a-migration