On Jun 11, 8:27 pm, Dave Howell <[email protected]> wrote:
> On Jun 11, 2010, at 8:02 , Jeremy Evans wrote:
>
> > On Jun 11, 12:40 am, Dave Howell <[email protected]>
> > wrote:
> >> I was all set to go ahead and 'create an accessor method myself' and then 
> >> realized I'm really not sure what to make it *on.*
> >> Well, on each member of self.ingredients, but the only way I see to do 
> >> that is (I think), to use :after_load to iterate through each one and add 
> >> a singleton method for 'percentage' to each. That seems very clunky. Is 
> >> there a better way?
>
> > If you want to create an accessor method just on objects retrieved
> > from that association, not really.  The better way would be to use
> > [:percentage] instead of .percentage.
>
> Hmm. It seems rather un-Ruby-ish.

You should realize that Sequel::Model is basically designed to wrap
the hashes that are returned by datasets.  If you think of
Sequel::Model instances as hashes with some convenience methods, then
it doesn't seem so odd to access their members with #[].

Jeremy

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

Reply via email to