Strong Parameters in Rails 4.2 – DIY Twitter Clone #6.3

[ad_1]
In this video tutorial, learn how to configure strong parameters with Devise to allow for username support. Additionally, learn how to implement custom URL routes for unique profile pages. This allows user’s to provide their own data (in our case tweets) that can be found at a /username/ URL pattern.

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

14 responses to “Strong Parameters in Rails 4.2 – DIY Twitter Clone #6.3”

  1. Christ Centered Dev Avatar

    Please note: That your "PROFILE" link on the Nav bar will be broken until you go to the next video. The solution is early in Video #7. lol..I wasted over an hour on this….

  2. Athomield3D Avatar

    it says rails unexpected | expected }

  3. Jil Pandya Avatar

    I cannot find the devise folder in the view folder

  4. DAPULSE ADMIN Avatar

    NoMethodError in Devise::SessionsController#destroy
    undefined method `for' for #<Devise::ParameterSanitizer:0x007f26b8271240> Did you mean? fork

    Extracted source (around line #12):
    10
    11
    12
    13
    14
    15

    protected
    def configure_permitted_parameters
    devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password, :password_confirmation, :remember_me) }
    devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:username, :email, :password, :password_confirmation, :remember_me) }
    devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:email, :password, :password_confirmation, :remember_me) }
    end

    Rails.root: /home/ubuntu/workspace

    Application Trace | Framework Trace | Full Trace
    app/controllers/application_controller.rb:12:in `configure_permitted_parameters'
    Request

    Parameters:

    {"_method"=>"delete",
    "authenticity_token"=>"mgCZzUgFwurni7AKXmYWzXeM2eCsgyy1L8okT0GIGL/4LCXvDqjVjRhiE7sx2GRX9fpMyV+Icf8wQcBfnIa/pw=="}
    Toggle session dump
    Toggle env dump
    Response

    Headers:

    None

    I keep getting this error when I try to load the sign-up or sign in

  5. CleverSource Avatar

    RIGHT WHEN I WAS DOING PERFECT UGH I HATE THIS SERIES MAKE A BETTER UPDATED ONE UGH!!!!!!!!!!!!!!!!!!!!!!!!!!
    protected
    def configure_permitted_parameters
    devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password, :password_confirmation, :remember_me) }
    devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:username, :email, :password, :password_confirmation, :remember_me) }
    devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:email, :password, :password_confirmation, :remember_me) }
    end
    undefined local variable or method `resource_class' for #<PagesController:0x00000004869800>
    wtf?
    undefined method `for' for #<Devise::ParameterSanitizer:0x00000004aa1eb0> Did you mean? fork
    protected
    def configure_permitted_parameters
    devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password, :password_confirmation, :remember_me) }
    devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:username, :email, :password, :password_confirmation, :remember_me) }
    devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:email, :password, :password_confirmation, :remember_me) }
    end

  6. Bobby Hutter Avatar

    important note 'for' is a deprecated term in rails 4.2.+-> replace 'for' with 'permit' in your ApplicationController

  7. Shpat Asllani Avatar

    Man I doesn't get the username to show up like you did! Help please

  8. Kris Chery Avatar

    I am learning a ton :). But did i miss something? When i sign up the username doesn't register in the database therefore it won't output it on the _nav_user view. I ran rails console to check if the username column existed. The username is still on of the in database schema but registers the users input as "nil". I am not able to retrieve the profile page unless i take out the code that you instructed to put in Pages controller under the profile. I am not sure what i missed but any help would be highly appreciated.

    –Update—
    Fixed my previous issue with the username not showing up in the nav bar but now for the life of me when i try to go on profile link. it flashes that a user isn't found. I think the code under profile in the Pages controller just isn't working. Help!

  9. Hot Dog Avatar

    Hey man, awesome tutorial! Just wondering, how could I change the default look of the Ruby 'action' button and change it to bootstraps btn-default?

  10. AvatarSquare Avatar

    When will the next parts to this be coming out?

  11. Valoride Avatar

    don't hate on this fella because if you do he will hack you lol
    no but seriously love your videos m8

  12. Richard Boseley Avatar

    I'm learning loads following your tutorials – thanks! I had some issues understanding when you change the link to the profile page (7:33). Could there be something missing?

  13. LuuKaos Avatar

    awesome! i did this all with java and JAX-RS a while back, but doing this with ruby seems so much easier.

Leave a Reply

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