Not sure this is actually a bug, but I'm curious in your thoughts about this issue.
In my controller I do something like this:
@products = Products.where('1=1') # There are a lot of products!
In my view I don't use @products. I expect that the query isn't executed, but the AssignsNote inspects the value exectuting the query. See:
Is there a way that a ActiveRecord::Relation's query doesn't gets executed?
Confirmed ActiveRecord::Relation#inspect executed the query
But I think you should report to rails
You can avoid big performance by adding .none to it, if you are not using it at all
Inspect probably should execute the query. Think about when you're using the rails console. If you do: Post.all, the console executes the command, and does an inspect on the result. If that inspect didn't execute the query, it wouldn't be what you'd hope. So, most of the time, inspect probably should execute the query.
Maybe check if it is an active record relation and add limit?
This issue is probably the culprit behind my problem in ActiveAdmin
If anyone's interested, I made a fork that will add a limit in assigns note here. It will only add a limit if there's no limit specified. The catch here is that it will add additional queries but at least it fixed cases like in ActiveAdmin. Default limit can be changed in the settings using this f.default_limit = 25
f.default_limit = 25