I don't think that's documented anywhere so the only place you could  
learn it is by reading the code. Hobo has the concept that every model  
object has a name. It is used all over the place, for example in the  
header on a show page, in cards which are listed on the index pages,  
and as you've seen in drop down menus. If you have a field called  
"name" or "title" Hobo will automatically use that as the object name,  
but if you don't you can tell it which field is the name using :name  
=> true.

On 15 Dec 2008, at 21:58, Hobo_Fan wrote:

>
> James,
>
> This is so great!!!! I do really appreciate your help. Where can I
> learn all of these tricks?
>
> Thanks again,
> Sean
>
> On Dec 15, 1:06 pm, James Garlick <[email protected]> wrote:
>> Try
>>
>> fields do
>>     product_name :string, :name => true
>>     ...
>> end
>>
>> On 15 Dec 2008, at 19:50, Hobo_Fan wrote:
>>
>>
>>
>>> Hi All,
>>
>>> Can someone point me to a right direction on how to customize the
>>> default belongs_to drop down list? One of my edit form, license
>>> belongs to both product and client models. I have a name field in
>>> product model; however, the drop down in the license assignment page
>>> only display the product table id and client table id. Is there a  
>>> way
>>> to have the drop down to display product_name and client_name  
>>> instead
>>> of id?
>>
>>> I have three models: client, license, and product
>>
>>> class Client < ActiveRecord::Base
>>
>>>  hobo_model # Don't put anything above this
>>
>>>  fields do
>>>    first_name :string
>>>    last_name :string
>>>    department :string
>>>    timestamps
>>>  end
>>
>>>  has_many :licenses
>>>  has_many :products, :through => :licenses
>>
>>> *****
>>> class License < ActiveRecord::Base
>>
>>>  hobo_model # Don't put anything above this
>>
>>>  fields do
>>>    license_type :string
>>>    quanty :integer
>>>    key :string
>>>    expiration_date :date
>>>    timestamps
>>>  end
>>
>>>  belongs_to :product
>>>  belongs_to :client
>>
>>> ****
>>> class Product < ActiveRecord::Base
>>
>>>  hobo_model # Don't put anything above this
>>
>>>  fields do
>>>    product_name :string
>>>    engine_version :string
>>>    platform :string
>>>    feature :text
>>>    timestamps
>>>  end
>>
>>>  has_many :licenses
>>>  has_many :clients, :through => :licenses
>>
>>> Below is what is currently displayed on browser, where is only shows
>>> product_id. Is possible to display product_name instead?
>>
>>> <tr>
>>> <th>
>>> Product
>>> </th>
>>> <td>
>>> <select class="product license-product input belongs-to"  
>>> name="license
>>> [product_id]">
>>> <option value="1" selected="selected">Product 1</option>
>>> <option value="2">Product 2</option>
>>> </select>
>>> </td>
>>> </tr>
> >


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