Hi Jeremy,
Thanks for your reply!
I also have another trouble in writing the code in ruby 1.9 mode.
see the code below:
one_to_many :linksource_visits
DB[:linksource_visits].
join(:geo_locations, ((:linksource_visits__ip >=
:geo_locations__ip_from) & (:linksource_visits__ip <=
:geo_locations__ip_to)))
Thanks,
David Wu
在 2013年1月9日星期三UTC+8上午12时16分26秒,Jeremy Evans写道:
>
> On Monday, January 7, 2013 9:41:33 PM UTC-8, 吴玉宏 wrote:
>>
>> hi everyone,
>> When I tried to upgrade ruby from 1.8.7 to 1.9 ,I got an issue
>> NoMethodError:
>> undefined method `<=' for :ip_from:Symbol
>> , which is raised from the code
>> filter((:ip_from <= ip) & (:ip_to >= ip)).first.
>>
>> All comparison operater >= ,<= ,> ,< used within the filter will raise
>> such similar error.
>>
>> All worked well in Ruby 1.8.7, but failed in ruby 1.9 mode.
>>
>> So, does anyone know how to write the code for the same functionality
>> filter in ruby 1.9 mode?
>>
>
> This is expected as Ruby 1.9 defines those methods directly on Symbol, and
> Sequel doesn't override methods defined by ruby.
>
> You should switch to using virtual rows:
>
> filter{(ip_from <= ip) & (ip_to >= ip)}.first.
>
> Thanks,
> Jeremy
>
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sequel-talk/-/MICMDrdZ4NkJ.
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.