Discussion Forums
Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
- Topic List
- Most Recent Posts
- Sign In for more options
How to show a list of radio_button Categories in another model. PLS HELP
1 Post
How to show a list of radio_button Categories in another model. PLS HELP
MODELS
Category has_many :jobs
Job belongs_to :category
CONTROLLERS
jobs def create
@catergory = Catergory.find(params[:catergory_id]) #It stores the value retrieved from the radio_button which displays the available categories to be added
@job = Catergory.jobs.create!(params[:job])
respond_to do |format|
if @job.save
format.html { redirect_to(@job, :notice => 'Job was successfully created.') }
format.xml { render :xml => @job, :status => :created, :location => @job }
else
format.html { render :action => "new" }
format.xml { render :xml => @job.errors, :status => :unprocessable_entity }
end
end
end
VIEW
new
{:multipart => true } do |f| %>
<br>
<span>"Senior Ruby Developer" or "HTML5 CSS3 Guru"</span>
<br>
<span>"Lincoln, UK", "Tallinn, Estonia", or "Anywhere"</span>
Category
"70x20" %>
"70x6" %>
<br>
<span>Example: Send your portfolio to studio@safarista.com</span>
<br>
<span>Example: 'Safarista Design', 'Safrista Jobs' or '37signals'</span>
<br>
<span>
Optional → Your company logo will appear at the top of youur listing.
<br>
190px wide is optimal. If larger we will resize it automatically.
</span>
<br>
<span>
Ex: http://www.safarista.com
</span>
<br>
<span>
This is where we will send you a confirmation receipt of your payment and listing.
</span>
<!--.company-->
ERRORs
Could not find Category without id.
What am I doing wrong?
Please help.
1 Post
