Assuming that the name column is the first field is definitely a bad assumption, you're right. Your last suggestion is good, but we can do even better.
The name field is not always :name. It's set through this mechanism: http://hobocentral.net/manual/model#name. It's available in klass.name_attribute. So what we should do is filter out klass.name_attribute from field_names, and then unshift `this` onto the front. I'd definitely merge a pull request that did this. thanks, Bryan On Sat, Mar 2, 2013 at 6:34 AM, Alex Greif <[email protected]> wrote: > Hi, > > I have many models which do not have the :name field (or not as the first > field), and wondered that the first field never shows up in the table of the > model index page. > > I found the reason in the > hobo_bootstrap-2.0.0.pre10/taglibs/index_page.dryml: > <% > if this.first > ... > field_names[0] = "this" > ... > end > %> > > I think overriding the first item in the array is a bug and it should > instead be an "insert before the first field". > Inserting the String "this" before the first field would list all fields as > columns. > So the code would change to: > <% > if this.first > ... > field_names.unshift("this") > ... > end > %> > > Another possibility to extends the current behavior is to check whether the > first field is "name", and only in this case replace the first array item > like > <% > if this.first > ... > if field_names[0].to_sym == :name > field_names[0] = "this" > else > field_names.unshift("this") > end > ... > end > %> > > > any ideas on this? > > thanks, > ALex. > > -- > You received this message because you are subscribed to the Google Groups > "Hobo Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/hobousers?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/hobousers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
