Re: [Rails-core] Possible bug in rails when I search a polymorphic association and array scope as LIKE

2013-04-08 Thread Alfonso Uceda
Ok thank you, I'm going to publish in github but this bug is still in Rails 3.2. A greeting! El viernes, 5 de abril de 2013 19:29:14 UTC+2, Steve Klabnik escribió: I did not, because it should be filed on the issues tracker if it affects 2.3. -- You received this message because you are

Re: [Rails-core] Possible bug in rails when I search a polymorphic association and array scope as LIKE

2013-04-08 Thread Matt Jones
There are two existing issues related to this: https://github.com/rails/rails/issues/950 https://github.com/rails/rails/issues/7402 The code in #7402 may be helpful in your particular situation. --Matt Jones On Apr 8, 2013, at 2:21 AM, Alfonso Uceda wrote: Ok thank you, I'm going to publish

[Rails-core] Uniquely identify the failed assertion

2013-04-08 Thread Alessandro Tagliapietra
Hello list, I was thinking that could be nice to be able to know which assertion failed during validation in an unique way (like knowing the validation name like 'length','presence' and so on) to don't rely on string matching which can easily lead to errors. I'm actually doing such things

[Rails-core] Proposed new ActiveRecord feature: Built-in orphaned scope for AR objects

2013-04-08 Thread Wes Gamble
For purposes of maintenance and data cleanup, sometimes it is helpful to determine if you have orphaned records in your AR backing store. Assuming that an AR::Base descendant has one or more belongs_to associations, I propose the addition of built-in association_name_orphaned scopes that would

Re: [Rails-core] Proposed new ActiveRecord feature: Built-in orphaned scope for AR objects

2013-04-08 Thread Ben Woosley
Hey Wes, If you use foreign key constraints, then all orphaned records would have the foreign key set to null. If not, you'd have to do an outer join to determine what is orphaned. Given this divergence, IMO this is best left to the author. -Ben On Mon, Apr 8, 2013 at 2:57 PM, Wes Gamble

Re: [Rails-core] Proposed new ActiveRecord feature: Built-in orphaned scope for AR objects

2013-04-08 Thread Wes Gamble
Ben, Depending on how things are set up, you may or may not have NULL values in the foreign key column. In either case, this query: Given: X: an AR::Base descendent class association_class: the belongs_to association class (discovered via association reflection) foreign_key: the foreign