On Monday, February 5, 2018 at 12:23:07 PM UTC-8,
[email protected] wrote:
>
> Hi Jeremy,
>
> In my app, due to the way that we organise our code, our Sequel Model
> classes are always named `Persistence` and are found inside a class with
> the actual 'model name' eg.
>
> ```
> class Task::Persistence < Sequel::Model(DB[:tasks])
> end
>
> class Questionnaire::Section::Persistence <
> Sequel::Model(DB[:questionnaire_sections])
> end
> ```
>
> At present, I'm having to declare all our keys and class names as the
> default assumptions in Sequel assume that the model in our is called
> Persistence. Is there a way that I can update Sequels default assumptions
> to work with this pattern? Declaring every key and class name starts to get
> a little messy after a while!
>
> Happy to write my own plugin if you could point me in the direction of
> where I should look.
>
You probably want to override Sequel::Model.implicit_table_name:
def (Sequel::Model).implicit_table_name
s = super
if s == :persistences
# s = something
end
s
end
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 https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.