On Feb 1, 2010, at 1:04 PM, tomPorter wrote:

For example I have a Book model, and the  first column defined in the
model book.rb is an isbn.  Title is the third field defined, even in
the most recent schema.rb.

BUT when I display the list of books, I see the titles displayed.
This is fine, but I'm not sure how this happened.

The default card tag looks for a name attribute on the model. Obviously, Book doesn't have one of those - but the name_attribute function tries some other likely candidates ('title' is the only other one presently).

You can explicitly specify an attribute to be used in this fashion by adding :name => true to the declaration of the field in the model.

As to the card, I'd check out the cookbook which should have some info on customizing the <card> tag. If you're just interested in having "Author - Title" instead of just "Title" in the links, one quick way would be (in book.rb):

def title_and_author
  "#{author.name} - #{title}"
end
self.name_attribute = 'title_and_author'

--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.

Reply via email to