I appreciate all of the help!
My application.dryml currently is using the hjq-input-many but I've
tried with input-many as well.
The Sales and Item forms now are defined as:
<!-- custom tag for item fields -->
<def tag="item-fieldlist">
<table class="field-list">
<tr>
<th class="book-label">
Book
</th>
<td class="book-view">
<name-one:book complete-target="&@item"
completer="pick_book"/>
</td>
</tr>
</table>
<field-list fields="item_desc, cost, sell_price" param/>
</def>
<!-- Item form -->
<def tag="form" for="Item">
<form merge param="default">
<error-messages param/>
<item-fieldlist />
<div param="actions">
<submit label="Save" param/><or-cancel param="cancel"/>
</div>
</form>
</def>
<!-- Sale form -->
<def tag="form" for="Sale">
<form merge param="default">
<error-messages param/>
<table class="field-list">
<tr>
<th class="contact-label">
Contact
</th>
<td class="contact-view">
<name-one:contact complete-target="&@sale"
completer="pick_contact"/>
</td>
</tr>
</table>
<field-list fields="old_sale_key,sale_date,sold_to,payment_type,
taxed,tax_exempt_no,sales_tax,amt_tender,
pct_discount, amt_credit, amt_shipping,
amt_due, items">
<items-view:>
<hjq-input-many>
<item:>
<item-fieldlist />
</item:>
</hjq-input-many>
</items-view:>
</field-list>
<div param="actions">
<submit label="Save" param/><or-cancel param="cancel"/>
</div>
</form>
</def>
I believe that I had this problem even before overriding the forms.
Hopefully its something silly.
My Sales model is:
class Sale < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
old_sale_key :integer
sale_date :date
sold_to :string, :name => true
payment_type :string
taxed :boolean
tax_exempt_no :string
sales_tax :dollars, :scale => 10, :precision => 2
amt_tender :dollars, :scale => 10, :precision => 2
pct_discount :integer
amt_credit :dollars, :scale => 10, :precision => 2
amt_shipping :dollars, :scale => 10, :precision => 2
amt_due :dollars, :scale => 10, :precision => 2
timestamps
end
belongs_to :contact
has_many :items, :accessible => true, :dependent => :destroy
default_scope :order => 'sale_date DESC'
def sales_total
items.sum(:sell_price)
end
...
My Items model is:
class Item < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
item_desc :string, :name => true
cost :dollars, :scale => 10, :precision => 2
sell_price :dollars, :scale => 10, :precision => 2
timestamps
end
belongs_to :sale
belongs_to :book
...
Thanks again,
Mike
On Jun 30, 2:09 pm, Bryan Larsen <[email protected]> wrote:
> I've never seen an error like that one before, so no glib answer this
> time. Can you post some source I can try/look at?
>
> Bryan
>
>
>
> oldlibmike wrote:
> > Hi Bryan,
> > Progress! This approach works very well for the display and selection
> > of the data. However, I cannot save the Master detail form at all.
> > When I try to save, I get:
>
> > NoMethodError in SalesController#update
>
> > You have a nil object when you didn't expect it!
> > The error occurred while evaluating nil.proxy_owner
> > RAILS_ROOT: /Users/mike/Dropbox/bookem
>
> > Application Trace | Framework Trace | Full Trace
> > /Library/Ruby/Gems/1.8/gems/hobo-0.8.8/lib/hobo/
> > accessible_associations.rb:8:in `prepare_has_many_assignment'
> > /Library/Ruby/Gems/1.8/gems/hobo-0.8.8/lib/hobo/
> > accessible_associations.rb:98:in `items='
> > /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/
> > base.rb:2745:in `send'
> > /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/
> > base.rb:2745:in `attributes_without_hobo_type_conversion='
> > /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/
> > base.rb:2741:in `each'
> > /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/
> > base.rb:2741:in `attributes_without_hobo_type_conversion='
>
> > It looks like it is having context problems with which record to
> > save.
> > Any ideas?
>
> > Thanks in advance!
> > Mike
>
> > On Jun 29, 5:57 pm, Bryan Larsen <[email protected]> wrote:
> >> In general, JQuery widgets are usually fairly easy to integrate. For a
> >> simple example, look at the datepicker in hobo-jquery: it's 4 lines of
> >> cde in hobo-jquery.dryml and 3 in hobo-jquery.js.
>
> >> Bryan
>
> >>> I've also seem some very impressive jquery sortable/editable tables
> >>> but I don't think they would be that easy to integrate into a hobo
> >>> app.
> >>> - Mike
> >>> On Jun 29, 2:43 pm, Bryan Larsen <[email protected]> wrote:
> >>>> Sorry, I understand the question now.
> >>>> input-many uses a field-list rather than a form, and field-list is not a
> >>>> polymorphic tag. So in Hobo 1.0, there's no easy way around your
> >>>> problem. hobo-jquery partially fixes this problem, and Tom has some
> >>>> plans for Hobo >1.0.
> >>>> But in the meantime, here's what I'd do, to keep everything as DRY as
> >>>> possible.
> >>>> <def tag="item-fieldlist">
> >>>> define guts of form here...
> >>>> </def>
> >>>> <def tag="form" for="Item">
> >>>> <item-fieldlist/>
> >>>> </def>
> >>>> <def tag="form" for="Sale">
> >>>> <field-list:>
> >>>> <items-view:>
> >>>> <input-many>
> >>>> <item-fieldlist/>
> >>>> </input-many>
> >>>> </items-view:>
> >>>> </field-list:>
> >>>> </def>
> >>>> kevinpfromnm wrote:
> >>>>> Yeah, I was wondering this too. It doesn't seem to use the same form
> >>>>> code for the guts of the input-many... which makes sense since it's
> >>>>> inside a form already but is annoying as it means possibly needing to
> >>>>> code the form twice or once and include in the normal form.
> >>>>> On Jun 29, 9:54 am, Bryan Larsen <[email protected]> wrote:
> >>>>>> You seem to be on the right track. Can you post your code? Are you
> >>>>>> putting your override in application.dryml?
> >>>>>> oldlibmike wrote:
> >>>>>>> I have a master detail relationship with Sales and Items.
> >>>>>>> Sales has_many :items, :accessible => true, :dependent => :destroy
> >>>>>>> Items belongs_to :sale
> >>>>>>> When I display the sales edit form, there is a repeating group
> >>>>>>> of :items that I can presumably edit, add or delete.
> >>>>>>> I have tried to override the form for item and when editing an item
> >>>>>>> all by itself, my overrides work.
> >>>>>>> When the item appears on the sales edit form however, none of my
> >>>>>>> overrides are there. The default edit form for item is displayed.
> >>>>>>> How would I overrided the item form in the context of its parent Sale?
> >>>>>>> Thanks in advance,
> >>>>>>> Mike
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---