Thanks, Ray, but I still seem to be lost in what Hobo is expecting
inside a webmethod that is using hobo_ajax_response to refresh a
<table-plus>. Can't seem to get past this:
NoMethodError (undefined method `parcels' for nil:NilClass):
app/views/taglibs/application.dryml:299:in `parcels_table_part'
My current models (standard has_many :through setup): document,
document_parcel, parcel:
class Document < ActiveRecord::Base
hobo_model
fields do
name :string
end
has_many :document_parcels, :accessible => true
has_many :parcels, :through => :document_parcels
end
class DocumentParcel < ActiveRecord::Base
hobo_model
fields do
timestamps
end
belongs_to :document
belongs_to :parcel
end
class Parcels < ActiveRecord::Base
hobo_model
fields do
lot :string
end
has_many :document_parcels
has_many :documents, :through => :document_parcels
end
My application.dryml extends the form for a document to include a
<table-plus> for the parcels:
<table-plus with="&@document.parcels" part="parcels-table"
fields="id, lot">
<empty-message:>No parcels related to this document.</empty-
message:>
</table-plus>
Outside the extended form, I have controls to add a specific parcel to
the document:
<form web-method="addparcel" method="POST" update="parcels-table">
Lot: <input id="lot" type="text" name="lot"></input>
<submit label="Search"/>
</form>
In my documents_controller.rb, I have a webmethod named "addparcel";
def addparcel
hobo_ajax_response do
@document = Document.find(params[:document_id])
# Logic here to find the parcel identified by params[:lot]
# Logic here to add the found parcel to the document_parcels join
table (How do I do this?)
# How to satisfy Hobo's search for a 'parcels' method on
@document?
end
end
When I search for a specific parcel by specifying a "lot", I can see
the log file reporting that it's firing through "addparcel", but Hobo
continually reports this:
NoMethodError (undefined method `parcels' for nil:NilClass):
app/views/taglibs/application.dryml:299:in
`parcels_table_part'
Having located the @document, how do I satisfy Hobo's search for the
'parcels' method????
Been going in circles now for days....
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.