Equivalent to :methods option from ActiveModel::Serializers::JSON

2018-04-17 Thread Marcelo Pereira
Hello, I'm using the JsonSerializer Plugin in Sequel, but I need to add, to the serialized model, a property that comes from a method call (as opposed to from a database column). Is there a way to do this using this plugin, or should I try to create my own plugin for this? Best -- You

Re: Equivalent to :methods option from ActiveModel::Serializers::JSON

2018-04-18 Thread Marcelo Pereira
My bad, :include does indeed work as well. On Tuesday, April 17, 2018 at 10:06:18 PM UTC+2, Marcelo Pereira wrote: > > I checked the code, and saw that :include doesn't work, but :only does. > Thanks a lot for answering this quickly. > > On Tuesday, April 17, 2018 at 7:26:40 P

FrozenError when using pg_enum

2018-04-24 Thread Marcelo Pereira
Hello, I'm running Sequel 5.6.0 and Ruby 2.5.1 and, when I try to create a PostgreSQL enum, using the pg_enum extension, I get the following error. FrozenError: can't modify frozen # /usr/local/bundle/gems/sequel-5.6.0/lib/sequel/extensions/pg_enum.rb:112:in `parse_enum_labels'

Re: FrozenError when using pg_enum

2018-04-25 Thread Marcelo Pereira
Yes, you are right - this was a fairly obvious oversight on my part. Thanks a lot for the input. Best On Tuesday, April 24, 2018 at 10:38:33 PM UTC+2, Jeremy Evans wrote: > > On Tuesday, April 24, 2018 at 1:21:52 PM UTC-7, Marcelo Pereira wrote: >> >> Hello, >> >

Re: Equivalent to :methods option from ActiveModel::Serializers::JSON

2018-04-17 Thread Marcelo Pereira
I checked the code, and saw that :include doesn't work, but :only does. Thanks a lot for answering this quickly. On Tuesday, April 17, 2018 at 7:26:40 PM UTC+2, Jeremy Evans wrote: > > I think you can use the :include option for this, though I'm not sure what > the :methods option does in AMS.

Mysql2::Error: Duplicate entry for '%s' for key '%s' is not handled by UniqueConstraintViolation

2018-11-13 Thread Marcelo Pereira
Hello, I have this error being raised: ``` Mysql2::Error: Duplicate entry '...' for key 'index_users_on_userid_and_application_id': INSERT INTO `users` (`userid`, `application_id`, `created_at`, `updated_at`) VALUES (...) ``` and it doesn't get rescued with `rescue

Re: Should Sequel continue shipping tests in the gem?

2020-01-19 Thread Marcelo Pereira
I would guess most of the time users are not running Sequel tests and, if one wants to run them, it's simple enough to clone the repository - so I would say not shipping the tests sounds like a good idea. No strong opinions on this one, though - having the tests in the gem is, of course, not a

Re: Using pg_arrays operations in join conditions

2020-04-07 Thread Marcelo Pereira
Aha! Got it. Thank you very much! Best On Tue, 7 Apr 2020, 21:17 Jeremy Evans, wrote: > On Tuesday, April 7, 2020 at 11:11:59 AM UTC-7, Marcelo wrote: >> >> Hello, >> >> I'm trying to produce this query with Sequel, that would then run on >> PostgreSQL: >> SELECT o.id, coalesce(cg.price,

Re: Pagination does not work on models

2021-08-23 Thread Marcelo Pereira
To make it work, you need to: - Enable the extension prior to defining the FooModel class - Run the paginate method on the model dataset with FooModel.dataset.paginate(1,2) I'm not sure if there's a reason why the model doesn't proxy the paginate method to its underlying dataset. Best Em dom.,

Re: odd number of arguments for Hash

2021-08-29 Thread Marcelo Pereira
If you need to, you can call super in your initialize, passing the parameters the way Sequel models expect. Em dom., 29 de ago. de 2021 às 05:24, bee...@gmail.com escreveu: > Sorry...half way through a Saturday evening. I will try with a single > hash thrown, but how do I require such a