On Thu, Sep 2, 2021 at 6:30 AM 'petr@me.com' via sequel-talk <
sequel-talk@googlegroups.com> wrote:
> Hey Jeremy,
> thank you for your answer. What do you think about this solution?
>
> Sequel::Model.plugin :subclasses do |sub_class|
> sub_class.skip_auto_validations(:unique)
> end
>
Sure,
com' via sequel-talk <
> seque...@googlegroups.com> wrote:
>
>> Hi,
>> how can I disable/skip unique auto validations on all models?
>>
>> I've tried Sequel::Model.skip_auto_validations(:unique) but it's not
>> working...
>>
>
> skip_
On Wed, Sep 1, 2021 at 6:14 AM 'petr@me.com' via sequel-talk <
sequel-talk@googlegroups.com> wrote:
> Hi,
> how can I disable/skip unique auto validations on all models?
>
> I've tried Sequel::Model.skip_auto_validations(:unique) but it's not
> working...
>
skip_auto_
Hi,
how can I disable/skip unique auto validations on all models?
I've tried Sequel::Model.skip_auto_validations(:unique) but it's not
working...
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop
On Tuesday, March 12, 2019 at 2:08:01 PM UTC-5, Jeremy Evans wrote:
>
> Change committed:
> https://github.com/jeremyevans/sequel/commit/d198cc1851c7cba380632a35f88ca193c346d6ae
>
Fantastic news. Thanks Jeremy!
Mike
--
You received this message because you are subscribed to the Google
ers) and found that the old model name was still being
>> referenced when Sequel was working out the associations. Here is part of
>> the error message...
>>
>
> It is certainly not related to Mike's issue with constraint validations.
>
>
>> 2019-03-06 17:42:10 - Nam
with the new model name
> (auth_users) and found that the old model name was still being referenced
> when Sequel was working out the associations. Here is part of the error
> message...
>
It is certainly not related to Mike's issue with constraint validations.
> 2019
thoughts,
Nick
On Saturday, March 2, 2019 at 12:13:16 PM UTC-8, Jeremy Evans wrote:
>
> On Saturday, March 2, 2019 at 9:58:16 AM UTC-8, Mike Pastore wrote:
>>
>> Jeremy,
>>
>> Just to confirm something. It appears that dropping the table :foo does
>> not also d
On Saturday, March 2, 2019 at 9:58:16 AM UTC-8, Mike Pastore wrote:
>
> Jeremy,
>
> Just to confirm something. It appears that dropping the table :foo does
> not also drop all constraint validations for table :foo. So my down
> migrations should all look like this:
>
>
On Sunday, December 2, 2018 at 2:55:00 PM UTC-8, Steven Garcia wrote:
>
> Coming from ActiveRecord I was a bit perplexed by Sequel's behavior when
> validations fail.
>
> In a Rails app I could simply run a condition on @model.valid? and keep it
> moving.
>
> But Sequel
Nevermind - figured it out:
Sequel::Model.raise_on_save_failure = false
Just starting to get the hang of your API ;)
Cheers
--
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
Coming from ActiveRecord I was a bit perplexed by Sequel's behavior when
validations fail.
In a Rails app I could simply run a condition on @model.valid? and keep it
moving.
But Sequel actually throws an error, which breaks the app - so I find
myself doing this:
begin @site.update(r.params
I wanted to do validations outside of the model (so outside of
`Sequel::Model#validate`), and then I also found out that #valid? first
clears the errors. For me it worked that instead of `#valid?` I just used
`errors.empty?`, and it worked great for my case.
If you do want to have validations
Thank you, that's a simple solution.
On Thursday, July 2, 2015 at 5:06:22 AM UTC-6, Janko Marohnić wrote:
I wanted to do validations outside of the model (so outside of
`Sequel::Model#validate`), and then I also found out that #valid? first
clears the errors. For me it worked that instead
This is sort of a feature request I guess, and something that's caused me
to bang my head a few times now. Currently you can access #errors and
#errors.add methods on a model, but they're not of any use (that I'm aware
of). Any errors added using errors.add() prior to calling valid? will be
A quick example using irb:
irb(main):002:0 o = Order.last
irb(main):003:0 o.valid?
= true
irb(main):004:0 o.errors.add(nil, 'Test')
= [Test]
irb(main):005:0 o.valid?
= true
irb(main):006:0
On Friday, June 5, 2015 at 3:46:54 PM UTC-6, James wrote:
This is sort of a feature request I guess, and
On Friday, June 5, 2015 at 2:46:54 PM UTC-7, James wrote:
This is sort of a feature request I guess, and something that's caused me
to bang my head a few times now. Currently you can access #errors and
#errors.add methods on a model, but they're not of any use (that I'm aware
of). Any
These are the models :
class User Sequel::Model
self.raise_on_save_failure = false
end
class Addresses Sequel::Model
many_to_one: user
self.raise_on_save_failure = false
end
address = Addresses.find(id: 1)
user = address.user
DB.transaction do
address.delete
user.save
end
In
On Monday, March 31, 2014 7:39:01 PM UTC-7, Deepak Agrawal wrote:
These are the models :
class User Sequel::Model
self.raise_on_save_failure = false
end
class Addresses Sequel::Model
many_to_one: user
self.raise_on_save_failure = false
end
address = Addresses.find(id: 1)
rules, as DBMS's have gotten quite good at doing, why
trust ruby validations to the job (esp. when they can't prevent
scripting mistakes made outside the application's code-base like the
database constraints can)?
So this is something I'm definitely interested in and will try to take
a good look
Hi Jeremy,
First of all, thank you. I'm really happy that you've unified validations
and constraints. I found their separation to be a source of bugs and
confusion.
I've moved a small project over to the current version of the
extension/plugin and have three short comments.
If you look
to create database constraints that mirror
model validations when creating and altering tables. It adds
validation to a separate table. The plugin reads the metadata
from that table, and uses it to automatically validate your models
before saving.
The advantage to doing so is that your
Le 2012-08-14 à 02:07, Christian MICHON a écrit :
Hi Jeremy,
On Sun, Aug 12, 2012 at 2:39 PM, Christian MICHON
christian.mic...@gmail.com wrote:
One problem though: using this code, my saved Human object 'Bobby'
gets its id = 2, because 1st save did not work: is this the expected
another public branch
to GitHub, named consvals. From the commit message:
The extension allows you to create database constraints that mirror
model validations when creating and altering tables. It adds
validation to a separate table. The plugin reads the metadata
from that table, and uses
On Monday, August 13, 2012 11:07:52 PM UTC-7, Christian MICHON wrote:
One problem though: using this code, my saved Human object 'Bobby'
gets its id = 2, because 1st save did not work: is this the expected
behavior?
The reason you get id 2 is that it actually tries to do the insert for
On Tue, Aug 14, 2012 at 5:13 PM, Jeremy Evans jeremyeva...@gmail.com wrote:
On Monday, August 13, 2012 11:07:52 PM UTC-7, Christian MICHON wrote:
One problem though: using this code, my saved Human object 'Bobby'
gets its id = 2, because 1st save did not work: is this the expected
behavior?
you to create database constraints that mirror
model validations when creating and altering tables. It adds
validation to a separate table. The plugin reads the metadata
from that table, and uses it to automatically validate your models
before saving.
The advantage to doing so is that your
On Wednesday, August 1, 2012 12:38:15 PM UTC-7, Jeremy Evans wrote:
In a fairly unusual step for Sequel, I have pushed another public branch
to GitHub, named consvals. From the commit message:
The extension allows you to create database constraints that mirror
model validations when
On 1 Aug 2012, at 20:38, Jeremy Evans wrote:
In a fairly unusual step for Sequel, I have pushed another public branch to
GitHub, named consvals. From the commit message:
The extension allows you to create database constraints that mirror
model validations when creating and altering
In a fairly unusual step for Sequel, I have pushed another public branch to
GitHub, named consvals. From the commit message:
The extension allows you to create database constraints that mirror
model validations when creating and altering tables. It adds
validation to a separate table
On Saturday, July 7, 2012 5:25:31 PM UTC-6, cult hero wrote:
I've been looking for the best way to deal with that amounts to a case
insensitive column in PostgreSQL. (It stores email addresses.) I've found a
couple of options (an index using lower() and triggers using lower()) but
is there
I've been looking for the best way to deal with that amounts to a case
insensitive column in PostgreSQL. (It stores email addresses.) I've found a
couple of options (an index using lower() and triggers using lower()) but
is there some way to make validates_unique do so in an insensitive manner?
That makes sense. I'm going with the flag route, since I'd like to keep the
validation together and not create one in a before_save block. Thanks
Jeremy.
--
You received this message because you are subscribed to the Google Groups
sequel-talk group.
To view this discussion on the web visit
Also, I created a gist to test this out. It contains the original problem
and an fix implementation using a flag for conditional validation. Maybe
someone will find this useful if they run into the same problem.
https://gist.github.com/3014816
--
You received this message because you are
I have a parent model, Product, that has many Variants. I'm using
nested_attributes on the Product model. On the Variants model I have a
presence validation on the :product. When I try to persist the product with
some :variants_attributes, I get a validation error saying:
On Thursday, June 28, 2012 5:06:11 PM UTC-7, Jack wrote:
I have a parent model, Product, that has many Variants. I'm using
nested_attributes on the Product model. On the Variants model I have a
presence validation on the :product. When I try to persist the product with
some
method. no big deal.
On Mar 24, 3:28 pm, Jeremy Evans jeremyeva...@gmail.com wrote:
On Mar 24, 12:21 pm, cult hero binarypala...@gmail.com wrote:
These are valid points. I guess in that case, I need to figure out how
to get Sequel validations to work in line like AM's would for things
like forms
In my previous project I had my own validations system that had
carried over as a legacy component. I want to dump that in favor of
something in wider use.
My question is this: Should I use Sequel's validations or include
ActiveModel's in a new project. I'm guessing AM's integrates better
Personally, I would use Sequel's. The Rails API seems to change often on a
whim while Sequel breaks backwards compatibility on much rarer occasions.
Plus, if implemented right, you can invest your business logic in your
models and maintain easy portability to other systems.
Right now, I have one
So this isn't really supported by other ORM's and I can't find a match
in the Sequel rdoc for validations, so it's probably not supported.
But maybe there's a way to accomplish this.
One thing I've always wanted is class-level validation hooks that can
specify an arbitrary method name to run
On Oct 15, 7:44 pm, Nate Wiger nwi...@gmail.com wrote:
So this isn't really supported by other ORM's and I can't find a match
in the Sequel rdoc for validations, so it's probably not supported.
But maybe there's a way to accomplish this.
One thing I've always wanted is class-level validation
Is there an :if option available with validations? I am trying to
reproduce the restful_authentication plugin to work with sequel and
using something like this.
attr_accessor :password
validates_presence_of :password, :if = :password_required?
protected
def password_required
Ok, thanks. I'll give not_naughty a shot! Funny name :)
On May 26, 11:28 am, Jeremy Evans [EMAIL PROTECTED] wrote:
On May 26, 8:20 am, dusty [EMAIL PROTECTED] wrote:
Is there an :if option available with validations? I am trying to
reproduce the restful_authentication plugin to work
On May 26, 8:20 am, dusty [EMAIL PROTECTED] wrote:
Is there an :if option available with validations? I am trying to
reproduce the restful_authentication plugin to work with sequel and
using something like this.
attr_accessor :password
validates_presence_of :password
What's the suggested way to specify a 'validates_presence_of :attr'
validation where 'attr' is set in the before_create block?
save returns false and says that 'attr' is not set
save! works, no exceptions thrown, but I would prefer to use save.
Farrel
On May 8, 11:33 am, Farrel [EMAIL PROTECTED] wrote:
What's the suggested way to specify a 'validates_presence_of :attr'
validation where 'attr' is set in the before_create block?
save returns false and says that 'attr' is not set
save! works, no exceptions thrown, but I would prefer to use
On May 8, 5:03 am, Farrel [EMAIL PROTECTED] wrote:
On May 8, 11:33 am, Farrel [EMAIL PROTECTED] wrote:
What's the suggested way to specify a 'validates_presence_of :attr'
validation where 'attr' is set in the before_create block?
save returns false and says that 'attr' is not set
save!
I can't actually find it. SourceForge or did you mean RubyForge where
I can't find the patch either... :/
Am 18.04.2008 um 23:10 schrieb Uzytkownik:
On Apr 17, 8:39 am, Florian Aßmann [EMAIL PROTECTED] wrote:
Hi Uzytknownik,
If you provide attribute names on builder invokation you only
May I ask is it possible to use conditional validation in new Sequel?
I cannot find it neighter working nor in assistance documentation (I
can in validatable documentation, which sequel seems to use no more).
Regards
--~--~-~--~~~---~--~~
You received this
You can try the not_naughty plugin for validations:
http://groups.google.com/group/sequel-talk/browse_frm/thread/7ca5e048f427e829/978bfc9b8b71b82d?hl=enlnk=gstq=not_naughty#978bfc9b8b71b82d
On Apr 14, 9:50 am, Uzytkownik [EMAIL PROTECTED] wrote:
May I ask is it possible to use conditional
On Apr 14, 6:53 pm, Aman Gupta [EMAIL PROTECTED] wrote:
You can try the not_naughty plugin for validations:
http://groups.google.com/group/sequel-talk/browse_frm/thread/7ca5e048...
Thanks
--~--~-~--~~~---~--~~
You received this message because you
great!! =)
is there any place that i can log future bugs? thanks!
On Feb 16, 4:02 pm, Sharon Rosner [EMAIL PROTECTED] wrote:
In my model, I tried to put each in the validates block, but this
would generate errors on running spec.
However, if I place the each clause outside the validates
This was a bug in the assistance gem. I pushed out a new release so it
should be available in a few hours.
Would this also fix my poblem?
The following code using ADO fails.
db = Sequel.ado 'db_name', :user = 'sa', :password =
'some_pwd', :host = 'my_computer_name'
sql = 'select top 1 *
After some further thought I'm rewriting the whole thing again and
will also build an errors class. you'll probably see a solution later
today.
Sharon,
Two things that would be great to see as you rewrite validations are:
1) Make update(...) check for validations like save(...)
2
def errorify_field(attrs, col)
attrs.add_html_class!(error) if @_obj.respond_to?(:errors)
@_obj.errors.on(col)
end
After some further thought I'm rewriting the whole thing again and
will also build an errors class. you'll probably see a solution later
today.
best
sharon
After some further thought I'm rewriting the whole thing again and
will also build an errors class. you'll probably see a solution later
today.
Sharon,
I look forward to the new version!
Zack
--~--~-~--~~~---~--~~
You received this message because you are
On Jan 16, 2008 4:16 AM, Sharon Rosner [EMAIL PROTECTED] wrote:
hi everybody
the new validations implementation is in the trunk, so please give it
a whirl. i've tried to follow the validation specs as implemented in
ActiveRecord, rather than the validatable gem which is incomplete and
even
I would see the sequel-model class having a base set of validations
that are all performed on the code side. Then each database plugin can
somehow override this base set to provide validation from the
database. This would allow people to switch between databases without
any changes to their code
I'm curious about what seems to be a current state of saving a model
with validations. Right now it seems that obj.save will save the
object to the database regardless of whether or not it passes
validations. I would like to know if this is the intended behavior.
Right now
Errors are, as you say, database-specific.
However, we already do have database specific code, so it won't be
causing any portability issues that were not there in the first place.
That said, perhaps the simplest way of getting this started is to
implement the database_validates_constraint
model side to keep all that model logic in one place.
Meh, I don't have a good idea on how to solve that one.
I think validations should be separate from constraints. Those are
really two different things with different capabilities. I really
don't see the connection between them, and IMO there's
Hey Jeremy,
On Jan 15, 8:28 am, jrmy [EMAIL PROTECTED] wrote:
I would see the sequel-model class having a base set of validations
that are all performed on the code side. Then each database plugin can
I agree. There are certain validations that can only be performed
client side.
However
On Jan 15, 2008 8:38 AM, Sharon Rosner [EMAIL PROTECTED] wrote:
I'm curious about what seems to be a current state of saving a model
with validations. Right now it seems that obj.save will save the
object to the database regardless of whether or not it passes
validations. I would like
model. It seems to me that the constraints need to be
somehow defined model side to keep all that model logic in one place.
Meh, I don't have a good idea on how to solve that one.
I think validations should be separate from constraints. Those are
really two different things with different
Once again,
I'm not saying we should support constraints WITHIN the model.
Let me state my assumptions:
- validations exist to give users a nice error message to prevent
models from being saved, because otherwise, the database will raise a
nasty error
- validations do not validate 100
Wow, I didn't mean to uncork a can of worms on this one, I hope it got
as sorted out as it appears to be.
If I understand this correctly, I can expect to see a .save .save!
methods appear in sequel_model, as well as changes to the validations
so that some validations are done based on the model
I'm going to look at validations soon and do some refactoring. I will
also look into this problem. You could instead of saving, check for
errors before saving. however it seems more ideal for the object to
keep track of its own state in this case.
-Lance
On Jan 14, 2008 5:59 PM, Joe [EMAIL
I wish validations were tightly integrated into the database.
Validations are something that ActiveRecord was not good at.
For example, validating uniqueness or presence of an associated object
would actually not enforce validation (under rare race conditions).
This is because it is impossible
I'm not exactly sure what you are trying to accomplish.
there is a validates_uniqueness_of :column
also I believe you can group validations.. though we should pretty
this syntax up. Look how this is accomplished using the validatable
gem. This is subject to change in the future. Perhaps a combo
Some subtle design refactorings:
we should change validations validates so the block looks like this:
validates do
format_of :name, etc.
presence_of :name
end
Also validations is a class method in validatable :). Wayne and I are
refactoring right now.
Also a :with_options hash might
70 matches
Mail list logo