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 9040087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:53:49+00:00 2026-06-16T09:53:49+00:00

I added two fields to my devise user. I did this by adding them

  • 0

I added two fields to my devise user. I did this by adding them at the migrate file like this:

t.datetime  :access_bought_at, :default => DateTime.civil(0, 0, 0, 0, 0, 0, 0)
t.string    :access_type, :default => "none"

and then making those attributes accessible at the user model:

attr_accessible :email, :password, :password_confirmation, :remember_me, :access_type, :access_bought_at

Then made the migration (rake db:migrate).

But I’m having trouble accessing these fields and modifying them. I’m pretty new to rails, and I’m pretty sure the answer is pretty straightforward, but I cannot find (or understand what I find) about how to access and modify those field. This is what I’m trying to do. In certain controller I want to modify those fields, and I’m doing:

current_user::access_type = "forever"
current_user::access_bought_at = Date.current()

but then, if I make

puts current_user::email
puts current_user::access_type
puts current_user::access_bought_at

only the email get’s printed out. I’m guessing that I’m missing either missing a step and I’m not updating the database, or I’m doing it just plain wrong. I read here ( update a table which in not devise model on sign up using devise?) that I should just put a def in the model. A def how? It makes sense that since I change the model I should give instructions about how to modify it, so adding a method to do that seems right, but what should that method do?

  • 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-16T09:53:51+00:00Added an answer on June 16, 2026 at 9:53 am

    devise user model still have activerecord api like any other model

    current_user.access_type = "forever"
    current_user.access_bought_at = Date.current()
    current_user.save
    
    puts current_user.email
    puts current_user.access_type
    puts current_user.access_bought_at
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Devise for authentication with two custom fields added = :organization_id and :username
I have a gridview that displays items details, I added two template fields one
I added two private fields to my Java class. Eclipse prompted me to automatically
Here are sample pictures of two EditText fields I've added in an Action Bar:
How can I upsert (update if not added) two fields at the same time?
I have a gridvew on my form with some fields . I added two
I have two fields reference link and reference text that are added dynamically in
1) I have created a custom object Hello . Added two lookup fields to
I have two fields: last_modified : datetime updated_at : timestamp updated_at is a new
I have a simple view with two date fields with ValidationMessageFor controls added for

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.