Just for curious, Sequel can't do where query use a form which pass string direct in as ActiveRecord did, can i know why?

2021-11-19 Thread Billy Zheng
e.g. when use ActiveRecord, i can do where like this. Event.where("payload->>'kind' = ?", "user_renamed") For Sequel, i guess we have to do like this, right? Event.where(Sequel.lit("payload->>'kind' = ?", "user_renamed")) Why we need stick on add a Sequel.lit in this case when first arguments

DB.run("UPDATE investing_latest_news SET title = title, preview = preview;") not work done invoke with roda request?

2021-11-19 Thread Billy Zheng
Because i don't know what happen, so, i just try to reproduce here. I use following migrate to add chinese full text search feature use zhparser plugin, it works! https://github.com/zw963/marketbet_crawler/blob/master/db/migrations/2022143230_add_zhparser_extension.rb I use following

Re: Just for curious, Sequel can't do where query use a form which pass string direct in as ActiveRecord did, can i know why?

2021-11-19 Thread Jeremy Evans
On Fri, Nov 19, 2021 at 1:28 AM Billy Zheng wrote: > e.g. when use ActiveRecord, i can do where like this. > > Event.where("payload->>'kind' = ?", "user_renamed") > > For Sequel, i guess we have to do like this, right? > > Event.where(Sequel.lit("payload->>'kind' = ?", "user_renamed")) > > Why

Re: DB.run("UPDATE investing_latest_news SET title = title, preview = preview;") not work done invoke with roda request?

2021-11-19 Thread Billy Zheng
Okay, i update my code, like this: ``` r.is 'add-ts-keyword' do new_keyword = r.params['new_keyword'] if new_keyword.present? DB.run(Sequel.lit("INSERT INTO zhparser.zhprs_custom_word values(?) ON CONFLICT DO NOTHING;", new_keyword)) end r.redirect

Re: DB.run("UPDATE investing_latest_news SET title = title, preview = preview;") not work done invoke with roda request?

2021-11-19 Thread Jeremy Evans
On Fri, Nov 19, 2021 at 8:15 AM Billy Zheng wrote: > Because i don't know what happen, so, i just try to reproduce here. > > I use following migrate to add chinese full text search feature use > zhparser plugin, it works! > > >

Re: DB.run("UPDATE investing_latest_news SET title = title, preview = preview;") not work done invoke with roda request?

2021-11-19 Thread Jeremy Evans
On Fri, Nov 19, 2021 at 9:05 AM Billy Zheng wrote: > Okay, i update my code, like this: > > ``` > r.is 'add-ts-keyword' do > new_keyword = r.params['new_keyword'] > > if new_keyword.present? > DB.run(Sequel.lit("INSERT INTO zhparser.zhprs_custom_word > values(?) ON

Overriding association getter

2021-11-19 Thread adam.me...@gmail.com
Hi Jeremy, I'm working on something that has me a bit puzzled. I'd like to introduce an association that depends on a provided value, or fall back to a default. My plan is to overwrite the getter to accept an optional argument, and then to pass it along. But using `super` won't work. I have a

Re: Switch to GitHub Discussions?

2021-11-19 Thread Jeremy Evans
On Fri, Nov 19, 2021 at 2:41 PM adam.me...@gmail.com < adam.mediadr...@gmail.com> wrote: > I've changed my position on this, more in favour of the migration. > Recently, trying to share code snippets have become incredibly worse on > Google; much more than I remember. > > But going by my

Re: Switch to GitHub Discussions?

2021-11-19 Thread adam.me...@gmail.com
I've changed my position on this, more in favour of the migration. Recently, trying to share code snippets have become incredibly worse on Google; much more than I remember. But going by my experience migrating the Unpoly community, I'd say it would probably be easier to forget about the

Re: Overriding association getter

2021-11-19 Thread Jeremy Evans
On Fri, Nov 19, 2021 at 2:00 PM adam.me...@gmail.com < adam.mediadr...@gmail.com> wrote: > Hi Jeremy, > > I'm working on something that has me a bit puzzled. I'd like to introduce > an association that depends on a provided value, or fall back to a default. > > My plan is to overwrite the getter

Re: Overriding association getter

2021-11-19 Thread adam.me...@gmail.com
Oof. Precedence strikes again ;) I guess that's what I get for debugging after a long week. Thanks for catching that. Adam On Friday, November 19, 2021 at 6:02:07 PM UTC-5 Jeremy Evans wrote: > On Fri, Nov 19, 2021 at 2:00 PM adam.me...@gmail.com > wrote: > >> Hi Jeremy, >> >> I'm working

Trouble using nested_attributes and tactical_eager_loading together

2021-11-19 Thread s.brimd...@gmail.com
I'm having some trouble using nested_attributes in conjunction with the tactical_eager_loading plugin. Specifically, I'm trying to set a default value for a one_to_one association in before_validation only if that association doesn't already have an associated object via an update of a

Re: DB.run("UPDATE investing_latest_news SET title = title, preview = preview;") not work done invoke with roda request?

2021-11-19 Thread Billy Zheng
Okay, i will do more research with add a trigger for find out this issue caused by UPDATE statement invalid, or just stored generated column not updated when do UPDATE, even, DB.run not works with Roda request? will be in touch, thanks 在2021年11月20日星期六 UTC+8 上午1:38:06 写道: > On Fri, Nov 19,