I have a partial called _profile.html:
<p> <b>Name</b><br /> <%= f.text_field :name %> </p> <p> <b>Email</b><br /> <%= f.text_field :email %> </p> <p> .....
edit.rhtml is using the partial as follows:
<h1> Edit Your Billing Profile </h1> <%= error_messages_for :billing_profile %> <% form_for :billing_profile, @bp, :url => billing_profile_path(@billing_profile), :html => { :method => :put } do |f| %>
<%= render :partial => "profile", :locals => { :f => f } %> <p> <%= submit_tag "Update" %> </p> <% end %>
<%= link_to 'Show', billing_profile_path(@bp) %> | <%= link_to 'Back', billing_profiles_path %>
and new.rhtml is using it as follows:
<h1>New billing_profile</h1>
<%= error_messages_for :billing_profile %> <% form_for(:billing_profile, :url => billing_profiles_path) do |f| %>
<%= render :partial => "profile", :locals => { :f => f } %> <p> <%= submit_tag "Create" %> </p> <% end %>
<%= link_to 'Back', billing_profiles_path %>
My question is how do I use partials for show.rhtml? I used the scaffold generator of Rails 1.2 and it looks like:
<p> <b>Email:</b> <%=h @billing_profile.email %> </p>
<p> <b>Business phone:</b> <%=h @billing_profile.business_phone %> </p> ...... <%= link_to 'Edit', edit_billing_profile_path(@billing_profile) %> | <%= link_to 'Back', billing_profiles_path %>
I tried several things but it breaks the functional tests. TIA.