>
> You should describe what are you doing inside the no connection block. (You
> mentioned using attribute accessors, but in order to generate these
> accessors, AR must have an open connection so it can fetch information about
> table columns.) Describe shortly what you were expecting to get and how the
> new behavior surprises you and breaks your tests.
>
Basically, I have a test that I don't have N+1 problem when collecting
data.
I do something like this:
# in the production, this may generate hundreds of items (which have own
associations)
sub_model_items = model.preload_subitems
assert_no_database {
json = sub_model_items.build_json
}
What I'm trying to test - that my code doesn't perform SQL operations
when building json, i.e. all data should be preloaded.
Thanks,
KIR
--
Kirill (KIR) Maximov
Software Engineer & Starter
Twitter: http://twitter.com/maxkir
Skype: maxkir
http://kirblog.idetalk.com | http://checkvist.com |
http://www.jetbrains.com/teamcity
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.