You're likely looking for the split_values plugin.

http://sequel.jeremyevans.net/rdoc-plugins/classes/Sequel/Plugins/SplitValues.html

On Thursday, February 25, 2021 at 8:18:39 AM UTC-5 [email protected] 
wrote:

> BTW if possible I would like to do this on model-level instead of delete 
> "pid" before every save manually on whole project-wide.
>
> On Thursday, February 25, 2021 at 4:06:25 PM UTC+3 [email protected] 
> wrote:
>
>> Hi Jeremy,
>>
>> I have a "Dir" Model (dirs table) and I do some joins when i fetch data 
>> from it.
>>
>> For example:
>>
>> dir = Dir.select{ dirs.* }.select_append(Sequel[:paths][:pid])
>>          .join(:paths, id: path_id).where(name: 'My Dir')
>>           .first
>>
>> As you can see, I get all fields/columns from `dirs` table and also one 
>> more field from `paths` table called `pid`.
>>
>> Problem is, when I change something on this result and call `save`, 
>> Sequel says `pid` is npot available on `dirs` table. Of course, pid is 
>> belongs to paths table.
>>
>> So my question is how can I exclude "pid" field when I save this mode? 
>> See:
>>
>> dir = Dir.select{ dirs.* }.select_append(Sequel[:paths][:pid])
>>          .join(:paths, id: path_id).where(name: 'My Dir')
>>           .first
>>
>> dir.name = 'My New Dir'
>> dir.save # Error: "pid" is not in "dirs" table.
>>
>> Is it possible to filter "pid" before save/update?
>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/34eb1036-c207-4a61-a34d-e52cb3b855f5n%40googlegroups.com.

Reply via email to