on Controller
----------------------------
def index
@categories = Category.find(:all)
end
on View
----------------------------------------
<%= select("post", "category_id", @categories.collect {|p| [ p.name, p.id ]
}, {:include_blank => 'None'})%>
On Tue, Feb 16, 2010 at 5:08 PM, Veena Jose <[email protected]> wrote:
> Hello Friends,
> I am a newbie in ROR.
> Can you plz tell me how to populate the combobox with data from db?If
> you could give both the view and controller part it would be helpful.I
> am using a Mysql database
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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]<rubyonrails-talk%[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.