Beginners partials question

I have an observe field for a select field.

<%= f.label :type_id%>
<%= f.select :type_id,RuleType.all.collect{|c| [c.description,c.id]} %>

<%= observe_field 'type_id', :url => { :controller => 'rule_type', :action => 'List' }, :update => 'List', :with => 'id=+value' %>

I created a partial that based on the selected value of type id will
either create another select or a text field.

<%= if @ruleListType == 5 >

<%= f.label :locationList %> <%= f.select :locationList ,Location.get_locations.all.collect{|c| [c.description,c.location_id]} %>

<%=else %>

<%= f.label :value %> <%= f.text_field :value %>

<%=end %>

I thought i can render the partial in the first view.
Because I have an observe field I need to create a method caleld List
that will be called. In this method I can check id ==5 then render a
partial that has the locationList if not render a different partial that
is just a text field.

  1. How do I write the code for the controller?
  2. If I render from the controller where on the view are these fields?
    Right after the first select bec the obeserve field is there? I want it
    somewhere else is there a way to do this?

Thank you

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs