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 Customizing Forms Creating Relationships

:first_name, :last_name and :profile_name aren't linked as they should be.

Rails isn't accepting the "attr_accessible " part of the file, instead they want the symbols to be put into the controller of the relatable model passing it as strong parameters or something like that, long story short, when a user signs up as my project is currently the email and password gets registered with devise or database , but the first_name, last_name and profile_name does not. How do I fix this?

2 Answers

Seph Cordovano
Seph Cordovano
17,400 Points

I'm also using rails 4.

My application controller finally looked like this after quite a number of hours of debugging this is issue and not much help from the Treehouse forums. Replace (:profile_name, :email, :first_name, :last_name, :password) with whatever you have in yours.

app/controllers/application_controller.rb

class ApplicationController < ActionController::Base
before_filter :update_sanitized_params, if: :devise_controller?

   protect_from_forgery with: :exception 

end

def update_sanitized_params
  devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:profile_name, 
    :email, :first_name, :last_name, :password) }
end