I think you're looking for something like radio_group.  Based on your
previous example, I would code it as:

<div>
  <%= f.radio_group :postType_id, PostType.all(:order => "name ASC").map
{|pt| [ pt.id, pt.name ] }
</div>

On Sun, Feb 20, 2011 at 5:21 AM, oliver torres <[email protected]>wrote:

> Hi all, am writing a simple app that lets me pick a post type to go
> under National or International.
> the code bellow generates  a drop-down   from where I can pick the
> options
>
> <div>
>   <%= f.collection_select :postType_id, PostType.all(:order => "name
> ASC"), :id, :name %>
> </div>
>
> what would be the syntax for this if instead I wanted to have two
> radio buttons
> I search for some sample code but all i've found is only with hard
> coded strings.
>
> any idea how I can generate two radio buttons for:
> O National
> O International
>
> ?
> any help will be greatly appreciated.
> oli.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" 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/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en.

Reply via email to