On Dec 2, 2010, at 1:04 PM, Tuishimi wrote:
> Hmmm... it isn't liking this.... in my model I added:
>
> def self.error_summary
> ActiveRecord::Base.connection.execute(
> 'select error_names.description, count(error_names.id) as count
> ' +
> 'from error_logs, error_types, error_names ' +
> 'where error_types.parent_table = \'XXXXXXXXXXX\' ' +
> 'and error_types.id = error_logs.error_type_id ' +
> 'and error_names.id = error_logs.error_name_id ' +
> 'and error_logs.parent_table_row_id = #{id} ' +
> 'group by error_names.description'
> )
> end
>
> Is causing this to barf:
>
> <repeat attr="error_summary">
> <table-plus fields="description, count">
> </table-plus>
> </repeat>
>
> ...or can't I insert table-plus within a contrived collection?
table-plus is going to end up making lots of assumptions about what you're
passing to it being an AR-derived collection, so I think you're going to end up
doing some pretty messy contortions to make it work with this data. You're also
going to end up doing some pretty complicated stuff to wire up the real
features of table-plus (namely the sort columns and the search box) - both of
those typically feed into scopes on the collection, which might not be easy to
do here.
You're probably better off building the table markup explicitly (with a <tr
repeat> for the data rows) and using something client-side to do sorting;
Jquery has some pretty handy plugins to control sorting/filtering of a table
that's completely loaded on the page.
BTW, I don't think connection.execute in the above code is going to unwind that
#{id} interpolation, so you'll probably need to do it (and escape as needed).
--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.