Okay, I'm sure I'm missing something very basic here dealing with the
override of a new_for_x method.

I have a 'party' model which belongs_to a 'document' (and the document
has_many parties).

Because I might create different types of parties, I thought it would
be simple to pass a query parameter on the new-link for a party to
identify the type of party that needed to be created, e.g.

         http://localhost:3000/documents/1-test/parties/new?party_type=Employee

So, in the PartiesController, I overrode new_for_document as follows:

                class PartiesController < ApplicationController

                  hobo_model_controller
                  auto_actions  :all, :except => [:index]

                  auto_actions_for :document, [:create, :new]

                  def new_for_document

                     @party = Party.new
                     @party.party_type = params[:party_type]

                      hobo_new @party
                   end

                end


The above processing appears to work, and Hobo starts rendering the
auto-generated new-for-document-page in rapid/pages.dryml, shown here:

                <def tag="new-for-document-page" polymorphic/>
                <def tag="new-for-document-page" for="Party">
                  <page merge title="#{ht
'parties.new_for_owner.title', :default=>['New Party for']}
#{name :with => @document}">
                    <body: class="new-for-owner-page  party" param/>

                    <content: param>
                      <header param="content-header">
                        <h2 param="heading">
                          <ht key="parties.new_for_owner.heading">
                            New Party
                          </ht>
                        </h2>
                        <h3 param="subheading">
                          <ht key="parties.new_for_owner.subheading">
                            For:
                          </ht>
                          <a with="&@document"/>
                        </h3>
                      </header>

                      <section param="content-body">
                        <form owner="document" method="post" param>
                          <field-list: skip="document"/>
                          <submit: label="#{ht
'parties.actions.create', :default=>['Create Party']}"/>
                        </form>
                      </section>
                    </content:>
                  </page>
                </def>


But while processing this tag, Hobo chokes with the following error:

NoMethodError (undefined method `parties' for nil:NilClass):
  hobo (1.0.1) taglibs/rapid_forms.dryml:166:in `send'

I presume it's looking for a 'parties' instance variable for the
labels that is now no longer defined because of my override.

What am I missing to be able to provide the 'parties' object Hobo is
looking for?

Many thanks,
Tim

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" 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/hobousers?hl=en.

Reply via email to