# Beginners partials question

**URL:** <https://www.ruby-forum.com/t/beginners-partials-question/174708>\
**Category:** Rails\
**Created:** [August 31, 2009, 6:35pm UTC](https://www.ruby-forum.com/t/beginners-partials-question/174708 "2009-08-31T18:35:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![newtoror](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@newtoror](https://www.ruby-forum.com/u/newtoror)\
**Post date:** [August 31, 2009, 6:35pm UTC](https://www.ruby-forum.com/t/beginners-partials-question/174708/1 "2009-08-31T18:35:27Z")

</div>

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
