Re: [Rails-core] Provide all ActiveRecord exceptions with a `record` attribute

2016-12-02 Thread Mohamed Wael Khobalatte
Thanks for the response Matt. I agree about the StatementInvalid exception. In fact in my case it happened in a query on a collection, so exactly as you described. However it can happen on a individual object as well. Correct it if I am wrong, but ActiveRecord::InvalidForeignKey will also be

Re: [Rails-core] Provide all ActiveRecord exceptions with a `record` attribute

2016-12-02 Thread Matt Jones
> On Dec 1, 2016, at 6:07 PM, Wael Khobalatte wrote: > > Hey, > > It would be useful to inspect the record in question every time an > ActiveRecord exception is raised. This is currently possible with some > (ActiveRecord::RecordNotSaved for instance), but not

[Rails-core] Provide all ActiveRecord exceptions with a `record` attribute

2016-12-01 Thread Wael Khobalatte
Hey, It would be useful to inspect the record in question every time an ActiveRecord exception is raised. This is currently possible with some (ActiveRecord::RecordNotSaved for instance), but not others. Any idea what the rationale for this selection is? I initially thought that you can query