On Nov 26, 11:41 am, Eduardo Yáñez Parareda <eduardo.ya...@gmail.com>
wrote:
> Hello,
>
> I have custom queries that joins several tables, so I have written a
> model class to represent those data. I have extended it from
> ActiveRecord::Base in order to be able to use 'find_by_sql'. When I
> call 'find_by_sql' it seems to work fine, in the debugger I can see
> every record retrieved from DB with their values, but when I try to
> access those values through some accessors, they don't give me
> anything.
>
Your accessors are trying to read from instance variables, but
activerecord attributes aren't stored in individual instance
variables. Your initialize method doesn't have the signature expected
either. I'd try removing both
Fred
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment