Re: [ruby-112] questions about tableless column

From: bob s.
Sent on: Thursday, December 16, 2010 3:12 PM
Seems like this is way overkill here.

Why not do something more like:

class Post < ActiveRecord::Base
??? attr_accessor :terms_of_use
??? validates_acceptance_of :terms_of_use, :accept => true, :message => "You must accept the terms of use"

On Thu, Dec 16, 2010 at 2:58 PM, Owen Ou <[address removed]> wrote:
Hi all,

I have a question about ActiveRecord hope any of you can help me a bit. Thanks in advance :).

I have a ActiveRecord model which has a boolean field to indicate whether the use has accepted the license. I don't want to create a database column related to that but I would like it to consume all the validation stuff provided by ActiveRecord. There are lots of solutions on the web but all of them are focusing on tableless model, while my model also have other fields corresponding to table columns. Here is what I come up with:

This solution seems pretty verbose and I am wondering whether there are better ones out there.


Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Owen Ou ([address removed]) from Vancouver Ruby / Rails Meetup Group.
To learn more about Owen Ou, visit his/her member profile:
To unsubscribe or to update your mailing list settings, click here:
Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]

Our Sponsors

  • Brewhouse

    Vancouver's leading Rails development agency

  • Thinkific

    Web and mobile education for professionals.

  • BMC

    Business runs on I.T - I.T. Runs on BMC

  • Clio

    A suite of web-based tools to help manage your law firm

  • LX Ventures

    We launch technology companies.

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy