rails/activerecord/test
Neeraj Singh 66001f3606 fix respond_to? for non selected column
fixes #4208

If a query selects only a few columns and gives custom names to
those columns then respond_to? was returning true for the non
selected columns. However calling those non selected columns
raises exception.

    post = Post.select("'title' as post_title").first

In the above case when `post.body` is invoked then an exception is
raised since `body` attribute is not selected. Howevere `respond_to?`
did not behave correctly.

    pos.respond_to?(:body) #=> true

Reason was that Active Record calls `super` to pass the call to
Active Model and all the columns are defined on Active Model.

Fix is to actually check if the data returned from the db contains
the data for column in question.
2013-04-19 14:09:16 -04:00
..
active_record/connection_adapters Ensure disconnecting or reconnecting resets the transaction state 2012-09-15 00:03:04 +01:00
assets Added test to illustrate bad binary blobs. 2012-01-31 13:45:00 -06:00
cases fix respond_to? for non selected column 2013-04-19 14:09:16 -04:00
fixtures has_many through obeys order on through association 2013-04-04 15:45:13 -04:00
migrations Preserve magic comments and content encoding of copied migrations. 2013-03-09 15:38:02 +09:00
models Fix scope chaining + STI 2013-04-05 13:14:28 +01:00
schema Correctly parse bigint defaults in PostgreSQL 2013-04-05 09:37:08 -04:00
support Revert "Fix annoy warning, when executing testcase." 2012-11-30 12:07:55 +04:00
.gitignore
config.example.yml Simulated & actual (manual/skipped) PostgreSQL auto-reconnection tests. 2012-07-16 09:55:20 -07:00
config.rb