Hi all! I have events, event kinds and companies:
Company has_many :events Event belongs_to :company Event belongs_to :event_kind I'm generating a report sheet / progress chart for my users. Rows are companies, and columns are event kinds. My code is ugly, but works. I want to beautify it. Here's the current look (SPOILER: ugly, ugly, ugly): http://gist.github.com/319083 <table-plus with="&@companies" fields="&@fields"> <event-kind-1-heading-link:> <%=h @event_kinds.detect {|ek| ek.id == 1}.name %> </event-kind-1-heading-link:> <event-kind-1-view:> <a if="&this" with="&@events[this.to_i]"><%= this ? this.created_at.to_date.to_s(:short) : nil %></a> </event-kind-1-view:> <event-kind-2-heading-link:> <%=h @event_kinds.detect {|ek| ek.id == 2}.name %> </event-kind-2-heading-link:> <event-kind-2-view:> <a if="&this" with="&@events[this.to_i]"><%= this ? this.created_at.to_date.to_s(:short) : nil %></a> </event-kind-2-view:> </table-plus> This is all boiler plate. I'm sure I can automatically generate this. If I were using plain jane Rails, I'd have a partial to which I'd pass options. My problem stems from the fact that table-plus expects to have child attributes which match the field names. Notice I have a @fields ivar which at least tells me which columns are expected. So? How can I programatically generate columns for table-plus? Thanks! François -- 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.
