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 Creating an Authentication System Generating the Devise Views

Problem with data integration using mysql

Hi, my name is Wellington and I'm using mysql how database to my application. I have installed Devise to authentication, when I try create a new user, the system is not saving my fields on database, its only saving email and password. I don't know what is wrong. Could anyone help me with this problem I have created the migration and the fields are created in to table

Could anyone help me with this problem?

Thank You!!

2 Answers

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hey Wellington Alan are you using Rails 4.0? If so, try the following:

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

  protected

  def configure_permitted_parameters
    devise_parameter_sanitizer.for(:user) << :first_name, :last_name, :profile_name
  end
end

I'm using Rails 4.0.4. I put the code above but now I got the follow error:

/Users/wellingtonalan/Desktop/Projects/hospedaon/app/controllers/application_controller.rb:7: syntax error, unexpected ',', expecting keyword_end ...sanitizer.for(:users) << :nome, :sobrenome, :usuario, :telef... ... ^

I'm using Rails 4.0.4. I put the code above but now I got the follow error:

/Users/wellingtonalan/Desktop/Projects/hospedaon/app/controllers/application_controller.rb:7: syntax error, unexpected ',', expecting keyword_end ...sanitizer.for(:users) << :nome, :sobrenome, :usuario, :telef... ... ^