On Apr 24, 1:47 am, Serg Podtynnyi <[email protected]> wrote:
> In my table(model) I have varchar field called 'platforms' with value
> '1,2,3'
> Is there any way  to add alias model method that will return array of
> integers instead of string or even overload this field?

class Model < Sequel::Model
  def platforms
    super.split(',').map{|x| x.to_i}
  end
end

That will override the existing platforms method.  If you want
platforms to return a string but another method to return the array of
integers, I'm sure you can figure it out. :)

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