Ar Chron wrote:
> In your case, have the appropriate controller read in the statuses info 
> and hand that to the view...
> 
> @statuses = Status.find(:all, :order => 'something')
> 
> Then the view (or a partial) can do something like:
> 
> @statuses.each do |this_status|
>   radio_button("application", "status", this_status.value)
> end
> 
> or sumfink like that...

brill... i understand.

what i have done it put it in a partial in my page form.

I have a projects page with a list of project_tasks and I want to use 
the same code in this page and have the status in the form of a radio 
button for each task, so I have put the code into a partial in projects 
view.

This is my partial.

<% Status.find_all_by_type("Project").each do |s|%>
    <%= f.radio_button :status_id, s.id %>
    <%= f.label :status_id, s.name %>
<% end %>


I am trying to make a link to the partial on the projects show.html.erb 
page. I know the code below this will not work, but am trying to adapt 
it to take the task instead of the project form object.

    <%= render :partial => "statuses", :locals => { :f => f } %>

obviously my partial here will be expecting a project form object.. any 
clues?

<% form_for(@project) do |f| %>
    <% for task in @project_tasks %>
    <%= render :partial => "statuses", :locals => { :f => f } %>
    <% end %>
<% end %>

I want it to take the task object instead

any ideas?
-- 
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]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to