I want to share a partial between 2 or more controllers.
I have a “location” partial that I want users to enter “Address, City,
State, Zip” information in however I have “Payees”, “Institution”, and
“Event” models that can have “location” information stored with them.
Since I don’t want to duplicate the partial across each controller, I’ve
placed the partial in a “shared” folder however I’m having problems
rendering it with the appropriate model object.
A sample of my renders look like this:
<%= render :partial => ‘shared/location’, :object => @payee %>
A sample of my partial looks like this:
<%= location.text_field :address, :size => 60 %>
Obviously rails is complaining that the object is not related to a form
since I’m not using “form_for” or “fields_for” (see below for error).
“undefined method `text_field’ for #Payee:0x4472530”
How can I make this happen while keeping it DRY?