[Rails-core] find_by inconsistent return message

2015-02-08 Thread Иван Бишевац
User.find(1) for no record with gives: def test_error_message begin User.find(1) rescue ActiveRecord::RecordNotFound => e message = e.message end assert_equal message, "Couldn't find User with 'id'=1" end I expected same behavior wiht find_by! method but it doesn't give so desc

Re: [Rails-core] find_by inconsistent return message

2015-02-08 Thread Ryan Bigg
I think that sounds reasonable. Please submit a PR. > On 9 Feb 2015, at 03:07, Иван Бишевац wrote: > > User.find(1) > for no record with gives: > > def test_error_message > begin > User.find(1) > rescue ActiveRecord::RecordNotFound => e > message = e.message > end > > assert

Re: [Rails-core] find_by inconsistent return message

2015-02-09 Thread John Mileham
What about the security ramifications of logging potentially sensitive information? IDs can be sensitive, but often far less than other fields. There are legitimate use cases for using find_by on values that you'd prefer not to be logged or known by the end user. Making more-informative error pre

Re: [Rails-core] find_by inconsistent return message

2015-02-09 Thread Matt Jones
On Feb 8, 2015, at 11:07 AM, Иван Бишевац wrote: > User.find(1) > for no record with gives: > > def test_error_message > begin > User.find(1) > rescue ActiveRecord::RecordNotFound => e > message = e.message > end > > assert_equal message, "Couldn't find User with 'id'=1" > end

Re: [Rails-core] find_by inconsistent return message

2015-02-10 Thread brent
John Mileham wrote: > > What about the security ramifications of logging potentially sensitive > information? IDs can be sensitive, but often far less than other fields. > There are legitimate use cases for using find_by on values that you'd > prefer not to be logged or known by the end user.