Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9228817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:25:10+00:00 2026-06-18T05:25:10+00:00

I am using devise and i am trying to update extra fields has user

  • 0

I am using devise and i am trying to update extra fields has user log in. So in order for me to be able to update my user.longitude i had to create in new controller who is acting has the rails controller sessions. Here the code I have

class MysessionsController < Devise::SessionsController
  def create
    self.resource = warden.authenticate!(auth_options)
    set_flash_message(:notice, :signed_in) if is_navigational_format?
    sign_in(resource_name, resource)
    self.resource.longitude = params[:longitude]
    self.resource.update_attributes(params[:longitude])
    respond_with resource, :location => after_sign_in_path_for(resource)

  end
end

I know it doesn’t follow restfull and it doesnt work but i need to be able to update my user field and i am not sure how to do, this doesn’t give me anything wrong, but it doesn’t also modify it properly. Thank for any help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:25:11+00:00Added an answer on June 18, 2026 at 5:25 am

    Your line:

    self.resource.update_attributes(params[:longitude])
    

    Might return false if the record is invalid and silently fail. Check that out first.

    Second, you might want to take a look into alias_method_chain instead of copying the content of the create action of your inherited controller.

    Otherwise, this is to update a record after a user logged in. You should save the longitude AFTER he signs in. Wherever you redirect the user after he signs in, let the following call handle the longitude update. Easy way could be to store the longitude in session if it needs to survive.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Rails and I'm trying to create an app using devise for
Using devise 2.1.0 I am trying to send the new registration page a PricingPlan
I'm trying to create a simple profile tab which includes a gravatar using Devise,
I'm using Cancan, Devise, Rails 3 for my ordering application. Each user has many
I'm trying to request a single location update using the new LocationManager.requestSingleUpdate() method, but
I am trying to allow the user to reset their password using Devise's recoverable
I'm using devise and trying to force the user to sign in. after he
Iam Trying to create authentications using devise with riak as the database. I found
I'm using devise & devise_invitable in a rails 3 project, and I'm trying to
I'm trying to update a single databasefield of my current_user (devise). I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.