Comments (11)
Hey @ayraju update to latest spree_auth_devise 2-1-stable, as of 862921a you should be able to set those params with this code in your spree.rb initializer:
Spree::PermittedAttributes.user_attributes.push :f_name, :l_name
let us know if that goes wrong. And make sure you get it that every user can update those params. You shouldn't use that approach for params only allowed by certain kinds of users.
from spree_auth_devise.
I want to upgrade my application spree2.0 customizations to spree-2.1
My old customization: spree-2.0
Spree::User.class_eval do
attr_accessible :f_name, :l_name :gender
validates :f_name, :presence => true, :length => {:maximum => 25}
validates :l_name, :presence => true, :length => {:maximum => 20}
end
New work with strong parameters: spree-2.1
module Spree
UserRegistrationsController.class_eval do
private
def spree_user_params
params.require(:spree_user).permit(:f_name, :l_name)
end
end
end
Even though its not working as it got rollback..
Please any idea for adding new fields.
from spree_auth_devise.
@ayraju your second method works for me in Spree 2.1.2 & spree_auth_devise using 2-1-stable. Maybe you need to include the rest of the User fields as well as you're overwriting, not extending, the spree_user_params method. I have the following code in my /app/controllers/spree/user_registrations_controller_decorator.rb
Spree::UserRegistrationsController.class_eval do
private
def spree_user_params
params.require(:spree_user).permit(:first_name, :last_name, :email, :password, :password_confirmation)
end
end
from spree_auth_devise.
Hi @huoxito
Its working from front end fine i.e registration but not from admin interface as admin will add user.
It will work I hope If you do same change in spree::admin::userscontroller.
Hi @kitwalker12
yes, that will work as I tried earlier as overwritten. same we need to do from admin also.
Guys, please check my comments and let me know your thoughts.
from spree_auth_devise.
@ayraju It's done see 4220432. Thanks for pointing it out!
from spree_auth_devise.
@ayraju Can you share the deface code ? I am trying to add a similar field to the user registration form. But keep getting a no method error.
from spree_auth_devise.
You can add whatever fields by using this line on initializers/spree.rb for User.
Spree::PermittedAttributes.user_attributes.push :f_name, :l_name
from spree_auth_devise.
@ayraju Do we need to perform any migrations after adding this line to initializers/spree.rb ?
Snapshot of my initializers/spree.rb
Spree.config do |config|
config.site_name = "Ecommerce demo"
end
Spree.user_class = "Spree::User"
Spree::PermittedAttributes.user_attributes.push :phone_number
from spree_auth_devise.
@CapedCrusader make sure you running on latest spree_auth_devise 2-1-stable
from spree_auth_devise.
@huoxito Thanks,working now ! Updated to spree_auth_devise 2-1-stable
from spree_auth_devise.
I had not find the way to use nested_forms, for example: biil_address
to fill that at signup. Someone has any idea if that is possible using this, or I should implement this functionality. Thanks
from spree_auth_devise.
Related Issues (20)
- login error devise 4.3.0 HOT 10
- Authorization failure page is rendered for not authenticated user
- Spree::Api 'checkouts#update' in production mode causes exception in Metal decorator HOT 1
- Bypass option is deprecated
- Multiple issues with specs
- Login without email impossible due to unique index on `email` column
- Devise Syntax Error HOT 2
- customize user confirmation email url HOT 1
- How can I set up the devise lockable module?
- Alerts are duplicated
- Users can't be really destroyed
- Order token is persisted on logout
- No Way For Users To Re-send The Account Confirmation Email HOT 1
- UserRegistrationsController won't inherit from Spree::BaseController
- 2-Factor Authentication HOT 2
- ArgumentError:wrong number of arguments (given 0, expected 1) on Spree::User#send_confirmation_instructions (spree_auth_devise 4.3.0) HOT 6
- Spree backend user session fallback root path is not admin_path
- Uninitialized constant Spree::UsersController with spree legacy frontend HOT 2
- 4.5.0 breaks rails version resolution (bundler) HOT 1
- URL Generation issue after Admin login HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spree_auth_devise.