ActiveRecord includes not throwing exception in Rspec?

42 views Asked by At

When i try to add the some random string in active record includes is not failing instead returning the empty relation in rspec. enter image description here

In development env Same is throwing error in dev rails c enter image description here

1

There are 1 answers

3
kunashir On

As I understand it, Rails doesn't create objects of a model at this point only a relation object will probably be created. If you try to access any data from the collection you will get an exception.

User.includes(:junk).load

for example, raise the exception.