Adding Usernames to Devise – DIY Twitter Clone #6.2

[ad_1]
Learn how to add a username column to the Devise gem! In this episode, we will be performing a migration to enable us to use usernames as a field alongside the default fields provided to us by the Devise gem. This will allow us to later on identify users via usernames rather than emails – and to create unique URLs for each user’s tweets to reside.

Download this project’s files at:

——– SUGGESTED READING ——–

“Clean Code” by Robert C. Martin:
“Game Coding Complete” by Mike McShaffry:
“JavaScript and JQuery” by Jon Ducket:

——– ADDITIONAL INFORMATION ——–

Creating, updating and managing DevFactor’s large collection of tutorials requires many hours of work on a weekly basis. If you have found our tutorials useful, please support us by subscribing and sharing our videos on social media.

If you have any feedback in regards to how we could improve the channel’s content, editing, or organization feel free to get in touch and make a suggestion!

Subscribe on YouTube:

——– GENERAL INFORMATION ——–

DevFactor offers high-quality, project based tutorials on web development, game development and software engineering. Simply by subscribing you can gain access to our large library of free programming video tutorials.

DevFactor was started in order to aid anyone regardless of age, race, gender or location to learn how to build, maintain and deploy their own software applications.

#programming #code #devfactor


Posted

in

by

Tags:

Comments

11 responses to “Adding Usernames to Devise – DIY Twitter Clone #6.2”

  1. Caleb LaFeve Avatar

    Your public ip address is in this video, idk if its still yours considering that you uploaded this 2 years ago but just letting you know

  2. Andrew Morgan Avatar

    When I run $ @testUser = User.find_by_id(1) it returns:

    user id
    email address
    created_at
    updated_at

    I'm using a vanilla install of Devise. Is there a tutorial previous to this one that explains how to get Devise to capture the additional data that you describe in this video?

  3. Dustin McAllister Avatar

    After I migrate the database, and I enter the rails console I type in "@u = User.new" how come I am missing a lot of the columns you have and we entered in the google doc? Here is what mine says "=> #<User id: nil, email: "", created_at: nil, updated_at: nil, username: nil> "

  4. Elina Ziggina Avatar

    These tutorials are amazing, but I'm having problems with the file not migrating. I did everything in the tutorial correctly and used the correct command, but it just doesn't migrate. Is there any way I can fix that? After using the rake db:migrate the terminalssays this:

    == 20160612180424 AddUsernamesToUsers: migrating ==============================
    == 20160612180424 AddUsernamesToUsers: migrated (0.0000s) =====================

    My database isn't readable either, is that normal?

  5. Beyblade420 Avatar

    Really loving this series. Even though I don't care to keep my mockup of Twitter, it is giving me a great understand of how user auth works and creation of other elements in a dynamic website.

  6. Kris Chery Avatar

    Scratch the comment below. the add_index is the only thing that doesn't show up on my schema rb.

    t.username shows but the add_index users, ["username"], name: "index_users_on_username", unique: true doesn't show. HELP!!!

  7. Kris Chery Avatar

    when i type rake db:migrate, it migrate without adding the column index. I tried to do rake db:rollback —trace and this is what i get…

    I am running on rails 4.2.4 if that helps and ruby 2.2.3p173

    Any help would be awesome thanks.

    rake aborted!
    StandardError: An error has occurred, this and all later migrations canceled:

    Index name 'index_users_on_username' on table 'users' does not exist/Users/krischery/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:988:in `index_name_for_remove'

  8. Irene Li Avatar

    when i type in rake db:migrate, it migrates without adding the column and index. 🙁

  9. Rafael Fernandez Avatar

    Keep Em coming you are doing great, I think once more people get wind of the quality there will be many views

  10. Gildas Awesso Avatar

    Good video and great job. Continue this way we are with you

Leave a Reply

Your email address will not be published. Required fields are marked *