Hi Matt... I'll check that out! I think I am closer, but ... see my next message below (or above) regarding it looking for the ID that matches the class itself. I am wondering if there is an attribute that overrides that in addition to the finder_sql? OR if I need to do something in the viewhints class to tell it to use the finder_sql?
On Dec 1, 9:08 am, Matt Jones <[email protected]> wrote: > On Dec 1, 2010, at 10:53 AM, Tuishimi wrote: > > > Me again. I have a class with a has_many relationship to another > > table/model. I wrote some SQL to select the appropriate rows and it > > works fin SQL Developer when I substitute IDs for the parent model, > > but in the model itself it returns nothing. > > > I found one blurb online that said you must use single-quote strings > > so the string does not interpolate too early, I did that, but it still > > finds nothing. Some things are "X"'d out to protect the innocent. > > > has_many :error_logs, :finder_sql => > > 'select error_logs.* from error_logs, error_types ' + > > 'where error_types.parent_table = \'XXXXXXXXXXX\' ' + > > 'and error_types.id = error_logs.error_type_id ' + > > 'and error_logs.parent_table_row_id = #{id}' > > Some things to try: > > - what does the generated SQL look like in the log? Your code looks correct, > but maybe it's getting escaped or something. > > - if you fire up script/console and find whatever model has_many :error_logs, > does it return records there? That should show you if the problem is on the > SQL side or the Hobo view side. > > - are there any view permissions on the ErrorLog model? table-plus may be > finding rows and then hiding them from you. > > --Matt Jones -- You received this message because you are subscribed to the Google Groups "Hobo Users" 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/hobousers?hl=en.
