On Viernes, 14 de Agosto de 2009 18:31:31 [email protected] escribió:
> Hi,
>
> I wonder how I can choose which field in a model is showed in the
> dropdown box when using form_ui = select.
>
> Let me explain with the example below:
>
> I have two models.
>
> account
> has_many :posts
>
> post
> belongs_to accounts
>
>
> In the ActiveScaffold for posts, I added:
>
>   active_scaffold :template do |config|
>     config.columns[:account].form_ui = :select
>   end
>
> If I now look at the page generated by ActiveScaffold, I see a
> dropdownbox populated with: #<Account:0x232ff58> #<Account:0x14456da>
> etc. If I use a column called "name", this will show up. How can I set
> the column to show (e.g. email) in the dropdown box?

If you define to_label method it will be used, when to_label is not defined, it 
tries with name, title and to_s

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to