On Jun 30, 8:12 am, GregD <gditr...@fuse.net> wrote:
> All,
>
> Is there a way to reference a column named keys from a Model
> instance?  It will be very painful to rename the column from keys to
> something else.   This is not a ruby project.  I'm just using ruby,
> rspec, sequel to set up tests of the product/system.  So, is there a
> way to reference the column and not the method for 'keys'?
>
> What I'm trying to to is:
>
> model_instances.keys.should == <some-value>

You use Model#[]:

  model_instance[:keys]

> However, I'm not getting the value of th instance's column of keys.
> It is running the method keys and returning the array of keys.
>
> I did not design the DB and like I said this is not a ruby system.
> I'm just using ruby, rspec and sequel to test the system.  So, please
> no smartazz answers like 'that is stupid, rename the column'

Anytime you have a column name that overlaps with one of the standard
method names, you need to use Model#[].  All the column reader methods
do is call Model#[] with the name of the column.

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to sequel-t...@googlegroups.com.
To unsubscribe from this group, send email to 
sequel-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to