Hi Montgomery,
My progress was due mainly to redesigning my contact table.
I have contacts that own many sales and sales belongs to contact.
The contact can be a company and/or individual so I used to use a "def
name"
method which used company name if present else lastname + ', ' +
firstname.
I changed the design to use a simple database column called sortname
and I
populated it via a "before-create" callback.
Having done this, the "name-one" sort of works for the display.
If I start typing, a list of matching contacts pops up and I can
display one.
Unfortunately if I try to save the sale it aborts complaining about a
nil value
which I cannot find - I may post another query about that.
If I use the "new" form, however, the "name-one" simply aborts. I
believe
this has happened to other users as well.
So right now, my sales_controller looks like:
class SalesController < ApplicationController
hobo_model_controller
auto_actions :all
autocomplete :pick_contact do
hobo_completions :sortname, Contact
end
end
My extend form in application.dryml looks like:
<!-- Extensions for sale form -->
<extend tag="form" for="Sale">
<old-form merge>
<field-list:>
<contact-view:>
<name-one complete-target="&@sale"
completer="pick_contact"/>
</contact-view:>
</field-list:>
</old-form>
</extend>
Maybe this will help you as well. But as I said I have a ways to go to
actually
have it working.
I am trying to build a robust master-detail sales and sale-item form
complete
with auto-updating totals as items are added so I'll be trying out the
ajax parts
mechanism I suspect.
As I've said, this framework is extremely powerful but very sparsely
documented
and I think the documenters assume a very deep knowledge of rails and
hobo.
- Mike
On Jun 25, 1:39 pm, Montgomery Kosma <[email protected]> wrote:
> I'm following! I got to your earlier point with autocomplete - the
> 504 error - then realized I needed a formlet, so switched away from
> autocomplete back to select to narrow my issues to getting the damn
> formlet working.
>
> what changes did you make to get the name-one pop-up selections?
>
> On Jun 25, 8:54 am, oldlibmike <[email protected]> wrote:
>
>
>
> > Sorry for the long thread but if anyone is following, I get as far as
> > having the name-one pop up selections when updating the record now.
> > The update however fails with an unexpected nil object so I'm
> > debugging.
> > Inserts don't work at all though. New records give an error message
> > about "thiss" - note extra s.
> > If I can isolate the case I'll post a bug.
>
> > On Jun 24, 9:45 pm, oldlibmike <[email protected]> wrote:
>
> > > I am using Rails 2.3 latest version - might be the problem?
>
> > > Anyway, if I explicitly set the class and completer I seem to get:
>
> > > NoMethodError (undefined method `name_contains' for #<Class:
> > > 0x32dcd0c>):
> > > /Library/Ruby/Gems/1.8/gems/mislav-will_paginate-2.3.11/lib/
> > > will_paginate/finder.rb:170:in `method_missing'
> > > vendor/plugins/hobo/hobo/lib/hobo/model.rb:364:in `method_missing'
> > > vendor/plugins/hobo/hobo/lib/hobo/scopes/named_scope_extensions.rb:
> > > 20:in `send'
> > > vendor/plugins/hobo/hobo/lib/hobo/scopes/named_scope_extensions.rb:
> > > 20:in `method_missing'
> > > (__DELEGATION__):2:in `__send__'
> > > (__DELEGATION__):2:in `with_scope'
> > > vendor/plugins/hobo/hobo/lib/hobo/scopes/named_scope_extensions.rb:
> > > 19:in `method_missing'
> > > vendor/plugins/hobo/hobo/lib/hobo/model_controller.rb:696:in `send'
> > > vendor/plugins/hobo/hobo/lib/hobo/model_controller.rb:696:in
> > > `hobo_completions'
> > > app/controllers/sales_controller.rb:9:in `complete_pick_contact'
> > > vendor/plugins/hobo/hobo/lib/hobo/controller.rb:22:in `call'
> > > vendor/plugins/hobo/hobo/lib/hobo/controller.rb:22:in
> > > `included_in_class'
>
> > > Rendered rescues/_trace (32.8ms)
> > > Rendered rescues/_request_and_response (0.3ms)
> > > Rendering rescues/layout (internal_server_error)
>
> > > I truly appreciate the responses, but I just don't know how to debug
> > > this further. I guess a good working "name-one" example would be
> > > nice.
> > > Everything else regarding hobo seems incredibly useful but the "name-
> > > one" documentation seems to be written by the authors who try to guess
> > > what someone not familiar with the source code might run into.
>
> > > Hobo as a tool makes rails novices (like me) very productive in many
> > > areas but in others, we are really lost.
>
> > > - Mike
>
> > > On Jun 24, 3:18 pm, oldlibmike <[email protected]> wrote:
>
> > > > Hi,
> > > > Well the <contact-tag> suggestion doesn't seem to do anything. From
> > > > more googling and searching for other examples (there are very few!),
> > > > I think I need to include the field-list too correct?
> > > > And the examples seem to use <contact-view:> rather than <contact-
> > > > tag:>.
>
> > > > Using <contact-view:> will change the control to an input text control
> > > > but typing in it does a GET (I think) and displays a sub-window with
> > > > "The page you were looking for could not be found" . Do I have to use
> > > > ajax "part" logic? I am assuming that the "page" it cannot find is
> > > > related to the autocompletion. I read the tag reference for name-one
> > > > and find its examples confusing.
>
> > > > My extend looks like:
>
> > > > <extend tag="form" for="Sale">
> > > > <old-form merge>
> > > > <field-list:>
> > > > <contact-view:><name-one /></contact-view:>
> > > > </field-list:>
> > > > </old-form>
> > > > </extend>
>
> > > > To further complicate things, the item I am trying to do the lookup on
> > > > has a "def name" function to return the name - it is not a simple
> > > > column in the table. Is this a problem?
>
> > > > Thanks,
> > > > Mike
>
> > > > On Jun 24, 12:46 pm, oldlibmike <[email protected]> wrote:
>
> > > > > Thanks for the clarification on the "old-form". I don't get any errors
> > > > > now but unfortunately I still get a selection list on the form for
> > > > > contacts.
> > > > > It doesn't appear that the override is doing anything. I'll experiment
> > > > > some more. I'll certainly give the dryml manual another look!
>
> > > > > - Mike
>
> > > > > On Jun 23, 3:27 pm, kevinpfromnm <[email protected]> wrote:
>
> > > > > > You need to include the old form when extending otherwise hobo has
> > > > > > no
> > > > > > idea what you mean by <contact:> (btw it should be contact-tag)
>
> > > > > > <extend tag="form" for="Sale">
> > > > > > <old-form merge>
> > > > > > <contact-tag:><name-one /> ...
>
> > > > > > You might want to read through the dryml
> > > > > > guidehttp://cookbook.hobocentral.net/manual/dryml-guide. it helped
> > > > > > me get
> > > > > > a handle on parameters and attributes.
>
> > > > > > On Jun 23, 1:12 pm, oldlibmike <[email protected]> wrote:
>
> > > > > > > Thanks for the reply. I still don't quite understand it though.
> > > > > > > I have a sales table that :belongs_to contact.
> > > > > > > In the fields list for sales, there is "contact" which currently
> > > > > > > brings up a picklist of contacts - which doesn't work because
> > > > > > > there
> > > > > > > are over 10,000 of them.
>
> > > > > > > I tried overriding the contact field in application.dryml as:
>
> > > > > > > <extend tag="form" for="Sale">
> > > > > > > <contact:><name-one /></contact:
> > > > > > > </extend>
>
> > > > > > > For some reason, this causes my index page for sales to throw
> > > > > > > errors
> > > > > > > that method "contact" does not exist. I don't know why the form
> > > > > > > would
> > > > > > > impact the index page at all.
>
> > > > > > > I'm sure I'm missing some basic hobo concepts here. I'm rereading
> > > > > > > Kerouac for additional inspiration!
>
> > > > > > > Best Regards,
> > > > > > > Mike
>
> > > > > > > On Jun 23, 2:11 pm, kevinpfromnm <[email protected]> wrote:
>
> > > > > > > > From the cookbook taglib docs (http://cookbook.hobocentral.net/
> > > > > > > > api_tag_defs/field-list) the param name for each input tag is #
> > > > > > > > {this_field.to_s.sub('?', '')}-tag, so you'd use something like
> > > > > > > > <owner-
> > > > > > > > tag:><name-one />... in your override. I think you also need
> > > > > > > > to setup
> > > > > > > > the controller ajax response as well.
>
> > > > > > > > On Jun 23, 11:53 am, oldlibmike <[email protected]> wrote:
>
> > > > > > > > > I am getting further into my application and now find that I
> > > > > > > > > need to
> > > > > > > > > change some of my "pick lists" for owners to "name-one" due
> > > > > > > > > to the
> > > > > > > > > many possible entries.
>
> > > > > > > > > I cannot find any clear examples in the tutorials or
> > > > > > > > > documentation on
> > > > > > > > > exactly where and how I do form overrides.
>
> > > > > > > > > Do I create a "<extend tag="form" for "MyTable"> in
> > > > > > > > > application.dryml?
> > > > > > > > > How do I just change the input type for a "belongs-to" owner?
> > > > > > > > > The form
> > > > > > > > > defaults just use a field-list. Where and how do I control
> > > > > > > > > the type of
> > > > > > > > > input used for each field?
>
> > > > > > > > > Do I need to create an entire form from scratch if I don't
> > > > > > > > > want the
> > > > > > > > > default?
>
> > > > > > > > > I'd appreciate any guidance or examples!
>
> > > > > > > > > Thanks,
> > > > > > > > > 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
-~----------~----~----~----~------~----~------~--~---