ruby - Rails 4 and Devise: Devise not saving new information (First Name, Last Name, Profile Name) -


I am using Rail 4 and the tool to display the user's first name in the position I posted on my app. I am trying. I have done everything that I can think correctly (the database migrated after adding the user model) and the database is still not saving three new fields listed in my headline, Devise saves those things (email + Password), but new fields

Here is my user.rb:

  class user & lt; ActiveRecord :: Base # Include modules to develop by default are available: #: Confirmable,: lockable, timeline and: Universal plan: Database_ authorized, registerable, retrievable,: memorable, trackable , Valid: accessible access to #model access__accessible: role_ids, as = & gt; : Administrator attr_accessible: email,: password, password_confirmation ,: remember_me ,: first_name ,: last_name ,: profile_name end   

my db migration:

  class devisecreateUsers & Lt; ActiveRecord :: Migration Def changed to make_table (): | T | T.string :: first_name; T.string :: last_name; T.string :: profile_name; ## Database Authenticity t.string: Email, Empty: Incorrect, Default: "" t.string: encrypted_password, Blank: wrong, default: "## Recoverable t.string: reset_password_token t.datetime: reset_password_sent_at ## Memorandum T. Date Time: remember_created_at ## Trackable t.integer: sign_in_count, Default: 0, Blank: wrong t.datetime: current_sign_in_at t.datetime: last_sign_in_at t.string: current_sign_in_ip t.string: last_sign_in_ip ## Confirmable # t.string: confirmation_token # t .datetime: confirm_at # t.datetime: confirmation_sent_at # t.string: unconfirmed_email # if only reconfirmable ## lockable # t.integer: fail_attempts, default: 0, empty Are using: false # Then the lock strategy is: fail_attempts # t.string: Unlock_token # If only the unlock strategy is: Email or: both #t.datetime: locked_at t.timestamps end add_index: user,: email, unique: True add_index: users,: reset_password_token, unique: true # add_index: users,: confirmation_token, unique: correct # add_index: user,: unlock_token, unique: right end term   

do some research Afterwards, I do not think attr_accessible is compatible with Rails 4 and Devise, is it right? If so, how do I pass this new information into my division db? Does anyone know a good guide to do this?

Tell me if there is any other information that should be provided!

Thanks in advance

Cheers for those who help you, here are the How do I do this job:

I updated my application controller to:

  Class ApplicationController & lt; ActionController :: Base # Prevent CSRF attacks by raising an exception. For #API, you might want to use it: null_session instead with protection_from_forgery :: exception before_filter: configure_permitted_parameters, if: devise_controller? Protected def configure_permitted_parameters devise_parameter_sanitizer.for (: sign_up) {| U | U.permit (: first_name ,: last_name ,: profile_name,: email,: password)} devise_parameter_sanitizer.for (: account_update) {| U | U.permit (: first_name,: last_name,: profile_name,: email, password)} and end   

and be sure to add user_id to your status controller: < Pre> params.require (: status) .permit (: user_id ,: name ,: content)

This will save new fields in your DB and it will allow display in situations Be

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -