That or write a custom sql call to sort based off your spec there. Probably easier to add a separate column though unless you're experienced with sql.
On Jun 20, 7:19 pm, oldlibmike <[email protected]> wrote: > Thanks Bryan, > That does work for the displaying as name. I am also trying to use the > "name" function as a column in a table-plus and I find that I can't > sort on it nor can I filter it since it isn't an actual column in the > table. > > Is that a limitation? I could work around this by creating another > table column, hiding it and populating it via callback functions I > guess. > > - Mike > > On Jun 20, 5:23 pm, Bryan Larsen <[email protected]> wrote: > > > name doesn't have to be a field -- it can be an an attribute (function) > > on your model: > > > def name > > company.blank? ? lastname : company > > end > > > oldlibmike wrote: > > > I have a table in my application for Contacts that has company, > > > lastname and firstname fields. > > > I would like to use a 'virtual field' as the name=true field in the > > > model. > > > If the company is present, I want to use that field, otherwise I want > > > to use lastname ||, || firstname. > > > > Is there a way to do this conditionally in rails and/or hobo? > > > > Thanks! > > > Mike --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
