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

RoR simple app-Only email and password get saved, not first_name, last_name or profile_name

Im having an issue with first_name, profile_name and last_name in the database..after i sign up, only the email id and password get saved. I logged onto the console and cross checked this. Besides i went back a few videos to Jasons and while he was logging the console, even he had 'nil' assigned to the above first_name etc that i mentioned. Did i miss something?

9 Answers

Joao!!i fixed this problem man! :) just add from the following, whats missing in your applicationController<ActionController::Base...i guess you're using rails 4 too huh?

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

protected

def configure_permitted_parameters devise_parameter_sanitizer.for(:sign_up) << :username devise_parameter_sanitizer.for(:sign_up) << :first_name devise_parameter_sanitizer.for(:sign_up) << :last_name devise_parameter_sanitizer.for(:sign_up) << :profile_name
end end

João Pedro Nascimento
João Pedro Nascimento
1,407 Points

Yeah I'm using rails 4 !! what file change ?

its most likely the following that is missing from your class ApplicationController < ActionController::Base..just add it and see?

devise_parameter_sanitizer.for(:sign_up) << :first_name devise_parameter_sanitizer.for(:sign_up) << :last_name devise_parameter_sanitizer.for(:sign_up) << :profile_name

João Pedro Nascimento
João Pedro Nascimento
1,407 Points

I add the file to the code is application_controller.rb?

umm..kinda like you add the code to the file instead..you'll find the file applicaiton_controller.rb in that you would find the code that i pasted first.. except with devise_parameter_sanitizer.for(:sign_up) << :first_name devise_parameter_sanitizer.for(:sign_up) << :last_name devise_parameter_sanitizer.for(:sign_up) << :profile_name so just add this to it...

João Pedro Nascimento
João Pedro Nascimento
1,407 Points

worked ok, now when I add a new status he does not "handle" the user_id :/

post the error here man..