logo
down
shadow

Additional Processing Required in Registration for a Devise Login System


Additional Processing Required in Registration for a Devise Login System

Content Index :

Additional Processing Required in Registration for a Devise Login System
Tag : ruby-on-rails , By : leorick
Date : December 01 2020, 05:00 PM

I wish this helpful for you You have to overwrite configure_permitted_parameters of devise controller in application controller like this:-
# Application Controller:
before_filter :configure_permitted_parameters, if: :devise_controller?

def configure_permitted_parameters
    devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username,  :email, :password, :password_confirmation) }
end
Suppose you have has_one association of user with profile model:
# User model:
has_one :profile
accepts_nested_attributes_for :profile

#Profile model:
belongs_to :user
def configure_permitted_parameters
    devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username,  :email, :password, :password_confirmation, profile_attributes: [:phone_number, :address, :contact]) }
end

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Rails Devise registration with an additional model


Tag : ruby-on-rails , By : xie renhui
Date : March 29 2020, 07:55 AM
With these it helps Okay, it took me about 8 hours but I finally figured out how to make it work (if someone has a better/cleaner way of doing this, please let me know).
First I've created my own Devise::RegistrationsController to properly build the resource:
class Users::RegistrationsController < Devise::RegistrationsController

  def new
    resource = build_resource({})
    resource.build_client
    resource.client.build_company
    resource.client.build_address
    respond_with resource
  end

end
devise_for :users, :controllers => { :registrations => "users/registrations" } do
    get '/users/sign_up', :to => 'users/registrations#new'
  end

Devise: making additional parameters required


Tag : ruby-on-rails , By : brij
Date : March 29 2020, 07:55 AM
around this issue For this you have to apply validations on the sign up form. You can use two different ways for this
validates :name, presence: true

Rails - How to add additional column value into Devise registration table?


Tag : ruby-on-rails , By : Ted Leung
Date : March 29 2020, 07:55 AM
help you fix your problem You can override the sign_up_params in your controller:
class RegistrationsController < Devise::RegistrationsController

  private

  def sign_up_params    
    params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation...).merge({tenant_id: Tenant.create!.id})
  end
end

Devise. Registration and Login at the same page


Tag : ruby-on-rails , By : Techspirit
Date : March 29 2020, 07:55 AM

After a successful DEVISE login, how to redirect user back to previous action that required login?


Tag : ruby-on-rails , By : user187383
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • Rails 5 tries to save the empty string as nil
  • websocket-driver was not found on deploy
  • Dangerous query method deprecation warning on Rails 5.2.3
  • Using ERB in Markdown with Redcarpet
  • How to create list of unique array items from thousands of records in Rails?
  • Undefined method 'suspend_paypal' for User
  • Any good methods to find Ruby on Rails memory leak?
  • Why does if __FILE__ == $0 not work on Heroku with Rails 5.2?
  • Rails: How to implement login and authentication where i have five different user models in rails?
  • What is the impact of changing rails secret_key_base on production?
  • how to keep heroku dyno worker alive if web dyno goes to sleep?
  • syntax error, unexpected end-of-input, expecting keyword_end. when running rspec of feature file
  • How does form_with know which method to call inside a model?
  • When using activestorage in Rails 6, how do I retain a file when redisplaying a form?
  • How to override table column value with column value from second table if it exist?
  • Comparison of !! operator vs present?
  • Error parsing Gemfile when pushing to Heroku
  • Rails 5: How to save uniq element in Array of Hash get from API's response
  • Devise: Unable to redirect to current user edit profile after sign_up
  • How to fix "fatal :unable to look up https (port 9418) (No such host is known)
  • How do I create a self-referential association table rails migration
  • How to send a variable from an action without using the URL in Rails?
  • How to use Ruby on Rails functions within plain (non ROR) Ruby file
  • Rails 6 and Google Maps for Rails
  • Ruby .map hash values to key value pair in array
  • Rails Frontend, Backend, and API
  • How to make value attribute in the select option tag to have url's in rails
  • Can I apply methods to a model.where condition to get all object created in specific month?
  • With Capybara, how do you get assertions on transient elements to work?
  • Best way to combine results of two select statements without returning an array?
  • How add extra attribute in model object response in rails
  • How can I block file uploads in Rails?
  • how does has_many :through work with only two models?
  • validating attribute presence with condition
  • How to fix "Illegal Argument Exception" when creating an Elasticsearch index for a Rails model?
  • Rails / Ruby how to always show decimal precision
  • Problem accessing images uploaded to heroku thru RoR application
  • How do I create a new path/route in Ruby and then link to it?
  • Rails Migration To Add Index To The Difference Between 2 Columns
  • i am trying to show my posts title on show page but it shows this error again and again . i am beginner in rails
  • Syntax Error for Ruby on Rails "(" unexpected
  • Upgrading from Rails 4.2.1
  • Reset master to an empty state
  • Ruby .round() function rounding off the values, but storing the original value only in database
  • Is it possible to email users who are @mentioned in rails ActionText?
  • Skip Current Migrations but Apply Future Ones
  • How to handle data with two has_many associations
  • Show SQL ActiveRecord queries in rails console using SemanticLogger gem
  • Custom strategy for Omniauth
  • How to obtain constant memory usage when migrating a Rails application from mongoid (MongoDB) to ActiveRecord (Postgres)
  • how do i redirect to home page(root )when user signed out?
  • Ruby two strings in an IF condition
  • Nginx passenger integration mode always require Passengerfile.json file?
  • what class is returned after a delete action in rails
  • Convert an array of hash with symbols
  • How can i display a particular product?
  • Rails remove subarray from array
  • Ruby : How to record an object and reuse it for tests?
  • Rails multiple select on array attribute not working
  • How use local views built with gem devise in rails app?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com