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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:54:45+00:00 2026-06-13T22:54:45+00:00

im using Rails 3.2.8 and SQLite 1.3.6 and im running into troubles changing boolian

  • 0

im using Rails 3.2.8 and SQLite 1.3.6

and im running into troubles changing boolian variables in the database

SQLite translates “t” and “f” as true and false

this function wont update the :approved attribute (that is default false)

def activate
  @user = User.find(params[:id])

  if @user.update_attribute(:approved, 't')

    redirect_to "/" #this is the return i get so the update returns true

  else
   render "/users?approved=false"
  end 
end

But changing strings like @user.update_attribute(:email,'root@email.org') will update the email

how can i fix this do i need some kind of an sqlite adapter ?

i already installed activerecord-jdbcsqlite3-adapter and it messed up my app because i was too hasty and didnt notice that it was deprecated 😛

i found this thread : Rails 3 SQLite3 Boolean false
but i dont understand what i need to do in order to make Rails and SQLite communicate correctly as im a newbie in rails 🙂

also i think its worth mentioning that im running this on windows 7 x64

UPDATE

Apparently Rails does indeed know how to communicate with Sqlite, but the i have no idea why my code dosnt work for boolians lol

in my view i have :

<% @users.each do |user| %> 
<tr> 
  <td><%= user.id %></td> 
  <td><%= user.email %></td>
  <td><%= user.approved? %></td>
  <td>
<% if !user.approved? %>
  <%= link_to 'Approve', active_user_path(user), :method => :put %> 
    <% end %> </td> 
</tr> 
<% end %> 

This lists all the unapproved users and a link to activate them (set the bool to true)

and in my controller i have

    def activate
      @user = User.find(params[:id])

    if @user.update_attribute(:approved, true)

      redirect_to "/" #this is the return i get so the update returns true

    else
      render "/users?approved=false" #this is not rendered
    end 
  end

and my route

match "users/:id/activate" => "users#activate", :as => "active_user"

This works for other strings like the user name, address etc but not the bool’s

  • 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-13T22:54:46+00:00Added an answer on June 13, 2026 at 10:54 pm

    I solved this by using a integer migration to my users table, i have no idea as of why @user.update_attribute(:approved, true) didnt save to the database it must have had something to do with my setup

    i made the migration add_column :users, :is_approved, :integer, :default => 0 and when i want to activate a user i simply flip the integer value to 1

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

Sidebar

Related Questions

I have doing some POC in Ruby-on-Rails and using sqlite database, while doing this
Configuration: Integration tests for Rails project using RSpec, Capybara, Selemium driver, SQLite database. Situation:
I am working on rails 3 and sqlite db. Using a IN query. Currently
I have the following statement in Rails 3 using an SQLite3 database: word =
Possible Duplicate: NOTICES for sequence after running migration in rails on postgresql Application Using
Running a rails site right now using SQLite3. About once every 500 requests or
I'm using AR with Rails 3.0.9 and SQLite 3.6.22 (Ubuntu Lucid Lynx). I've added
Using Ruby on Rails combined with capistrano and git, I've run into an annoying
I'm a beginner in Rails, and I'm having trouble inserting rows into the database
I'm running rspec on a rails 3.0 environment. We've just switched to using sqlite3

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.