On Friday, November 8, 2013 9:54:14 AM UTC-8, Phrogz wrote:
> On Friday, November 1, 2013 9:16:49 AM UTC-6, Jeremy Evans wrote:
>>
>> Sequel 4.4.0 has been released!
>>
>
> I tried upgrading my server from 3.35 to this version, but I get errors
> related to monkeypatched Symbols:
>
> undefined method `desc' for :created_on:Symbol
> #=> first_entries = LogEntry.order( :fixin_id, :created_on.desc )
>
> undefined method `sql_function' for :sum:Symbol
> #=> painshots = graphshots.select_more(
> :sum.sql_function(:pain).as(:sum_pain) )
>
> I see that the former should probably now be:
>
> first_entries = LogEntry.order( :fixin_id, Sequel.desc( :created_on) )
> #ick
>
> However, I still see documentation referring to the usage of
> `sql_function`, e.g.
>
> http://jacaetevha.github.io/sequel/rdoc/files/doc/dataset_filtering_rdoc.html
>
> What's the replacement for this?
>
Well, you can just do:
Sequel.extension :core_extensions
There is nothing wrong with the core extensions, they aren't deprecated,
and using them generally results in nicer looking code. The main change in
Sequel 4 was that they are no longer used by default, so it's up to the
application to enable them.
That being said, the direct answer to your question is:
painshots = graphshots.select_more(Sequel.function(:sum,
:pain).as(:sum_pain))
or using virtual rows:
painshots = graphshots.select_more{sum(:pain).as(:sum_pain)}
The documentation in the dataset filtering guide says:
You can also use the {core_extensions
extension}[rdoc-ref:doc/core_extensions.rdoc] and the +sql_function+ method:
:avg.sql_function(:price)
This is after it shows how to use both Sequel.function and virtual rows to
accomplish the same thing.
Thanks,
Jeremy
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.