addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1linklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Re: [ruby-112] questions about tableless column

From: Owen O.
Sent on: Thursday, December 16, 2010 4:11 PM
Thanks everyone for the help!

I sorted it out that using validates_acceptance_of  is a simpler solution.

Thanks all!!!

On[masked], at 3:23 PM, Adam palmblad wrote:

Will validates_acceptance_of work?

From the docs, it appears that that will work fine for a virtual attribute.

-Adam

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: https://gist.github.com/744165.

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

Thanks,
Owen



--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
http://www.meetup.com/ruby-112/
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: http://www.meetup.com/ruby-112/members/12466466/
To unsubscribe or to update your mailing list settings, click here: http://www.meetup.com/ruby-112/settings/
Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]






--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Adam palmblad ([address removed]) from Vancouver Ruby / Rails Meetup Group.
To learn more about Adam palmblad, 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

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