Hi all;

I'm sure I'm not the first Hobo-er to try this, but I am looking for
guidance, since a number of hours have already ticked by and I am
going in circles. I am, by no means, proficient with Hobo (yet), and
certainly not with Ajax, but here's what I'm trying to pull off:

A document shows a table of related parcels. When viewing a document,
I want to seach for an existing parcel and add it the table of
parcels, without leaving the page (Ajax).

I have:

class Document < ActiveRecord::Base
   hobo_model
   fields do
        name    :string
   end
   has_many :parcels
end

class Parcels < ActiveRecord::Base
   hobo_model
   fields do
      lot        :string
      block   :string
   end
   belongs_to    :document
end

When viewing a document, I have a table-plus that lists all the
parcels related to the document:

<table-plus with="&@document.parcels" part="parcels-table" fields="id,
lot">
</table-plus>

Under this, I have a form by which I would like to search for a parcel
by lot number, and (if the parcel exists) add the parcel to the
document:

<form action="addparcel" method="GET" update="parcels-table"
message="Searching...">
        Lot: <input id="parcel[lot]" type="text" name="parcel[lot]"></input>
        <submit label="Search"/>
</form>

My documents_controller.rb has the 'addparcel' action defined:

  def addparcel
        @document = Document.find(params[:document_id])
        @parcel = Parcel.find(params[:lot])

        #Relate the parcel to the document
        @document.parcels << @parcel unless @parcel.nil?

        #What do I need to do here to get the document.parcels table to
refresh?
        #Something like this?

        respond_to do |format|
            format.html
            format.js
        end

   end


Am I on the right track, here, given this is blatant hacking trying to
figure out which was is up?

For the life of me, I cannot get past Rails bailing with this error:

ActionController::UnknownAction (No action responded to 1-new-
document. Actions: access_denied, addparcel,
authenticated_user_from_cookie, authorized?, create,
create_auth_cookie, create_for_package, destroy, edit, ht,
login_from_cookie, login_required, model, new, new_for_package,
redirect_back_or_default, show, store_location, and update):

The action exists, but what is missing?

Many thanks in advance,
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