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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:31:08+00:00 2026-05-10T15:31:08+00:00

On my rails app I have a list of items (like a task list)

  • 0

On my rails app I have a list of items (like a task list) and for each item there is a couple of check box to set parameters.

When I submit the form, the checked box are stored as zero and the unchecked as null on DB.

the question is: Is there a way to configure it? To store the data on a more traditional 0 or 1, because I think that storing null as false and 0 as true is a bit confusing, specially if another app (like a C app) needs to read the data.

  • 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. 2026-05-10T15:31:09+00:00Added an answer on May 10, 2026 at 3:31 pm

    Let’s assume that the attribute you are working with is club_member as in ‘are you a club_member?’.

    Note that in Ruby/Rails, the way it is working now, if model.club_member will return false if it is not checked (value is null or in Ruby, nil) and true if it is checked (value is 0).

    On the whole, I would strongly recommend that instead of letting other applications (like a C app) directly at your data, you should instead build an API in Ruby/Rails to expose the data from your application to external entities. In this manner, you will better encapsulate your application’s internals and you won’t have to worry about things like this.


    However, all that being said, here is your answer:

    Use:

    value='1' 

    …attribute in your checkbox HTML tags, and set the default value of the boolean attribute (in your migration) to 0.

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

Sidebar

Related Questions

I have a simple rails app the displays a list of items and i
In my Rails 3 app, I have a list of questions. Each question has
I have a ruby (1.9.3) on rails (3.1) app where: app/models/list.rb class List <
In my rails app I have user, school, and course models. I have set
So I have a Rails app (which in this case seems like it would
I have a Rails app running Mongoid on Heroku and I need to set
I've got a rails app that displays a list of items called modules. I'm
In my rails app, I want to have a sortable list as part of
I have rails app which has a list of users. I have different relations
I have a Rails app representing a card game. There are several different types

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.