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

Bryn Price
seal-mask
.a{fill-rule:evenodd;}techdegree
Bryn Price
Full Stack JavaScript Techdegree Student 7,253 Points

Not storing "first_name", "last_name", "profile_name"

I found once I got to this stage that I ran into a couple of issues with Rails 4, resolved the issues already posted on the forum.

I found the name wasn't appearing on my "show.html.erb" despite following the steps. I did a little bit of digging about found that actually, if I do "@status.user.email" it shows my email address, but if I "@status.user.first_name" nothing comes up. Using "ruby control" I did "user=user.all" and saw that I got: "User_id : 3, first_name: nil, last_name: nil, profile_name: nil..." and decided I'd try deleting that account and making a new one to make sure that I filled in those fields. But nope, nada.

Anyway, if it helps, this is my git hub (I am using Github differently to the videos, so it's only in the branch I've linked)

https://github.com/Saefinn/WaywardStarSite/tree/Authentication

ATM, I am a wee bit puzzled, I'll try rewatching the videos just to make sure I've not missed anything.

3 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

I wrote a blog post for this exact case, since lots of people on Treehouse have this problem when doing Treebook. This should help you understand and solve the issue:

http://mczuchnowski.github.io/tutorials/2015/03/15/devise-and-strong-parameters/

Doesn't seem to work for me. I have rails 4.2.1

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Can you upload your project to github and link it here? I will take a look and try to help you.

Bryn Price
seal-mask
.a{fill-rule:evenodd;}techdegree
Bryn Price
Full Stack JavaScript Techdegree Student 7,253 Points

Ah fantastic! That's done the trick. Thanks for the help and for the informative article on the differences between the 2 versions.

Prabhakar 55
Prabhakar 55
476 Points

Please add the below code in your application.rb file. Then it should work.

before_filter :configure_devise_params, if: :devise_controller?

def configure_devise_params devise_parameter_sanitizer.for(:sign_up) do |u| u.permit(:first_name, :last_name, :profile_name, :email, :password, :password_confirmation) end end