http://api.rubyonrails.org/ is the best resource for queries like
these. The answer to your question is a yes, just browse through the
documentation to figure it out.
now,perhaps i just can use the select or select_tag?
question tow:
i have a A model,it has one B such as:
class A< ActiveRecord::Base
belongs_to :B
when i use the form_for tag,how can i output the variable name?like
this:
<%form_for :a,@a,:url=>{:controller=>"a",:action=>"save"} do |f|%>
<%=f.text_area "b[name]"%>
........
<%end%>
You're trying to display a.b.name ? If so you could either drop down a level and use text_area_tag, or use fields_for to create a scope around b (and then you can just do other_f.text_area :name)
Your @a variable is nil. Make sure that you're setting it.
Also, I'm not sure if it would mess anything up or not, but naming the
param :b and setting the block variable to |b| might get confusing.
Perhaps you should use something else in the block.
This is not a helpful response whatsoever. People don't come to post
in Google Groups to get pointed to documentation.
Repeating all that info would degrade this forum. When a newb obviously does not know about the /Agile Web/ book, or the online APIs, or how to Google for our common FAQs, they need a meta-answer.