Have you tried using complete-target="&Assignment"? on the new page, @assignment doesn't have an id.
Are you using Hobo 1.3 or Hobo 1.4? The javascript for name-one is completely different in 1.4. cheers, Bryan On Thu, Jun 7, 2012 at 4:30 PM, David Mason Hill <[email protected]> wrote: > here's what i've got (noting that this same call to <name-one> works for my > edit-page for this same assignment model): > > <edit-page> > <form:> > <field-list: fields="hours_spent, minutes_spent, assignee, assignor"> > ... > <assignee-view:> > <name-one complete-target="&@assignment" completer="user_name"/> > </assignee-view:> > ... > </field-list:> > </form:> > </edit-page> > > <new-page> > <form:> > <field-list: fields="assignor, assignee, assigned_type, assigned, > hours_spent, minutes_spent"> > ... > <assignee-view:> > <name-one complete-target="&@assignment" completer="user_name"/> > </assignee-view:> > ... > </field-list:> > </form:> > </new-page> > > class AssignmentsController < ApplicationController > hobo_model_controller > auto_actions :all > > autocomplete :user_name do > hobo_completions :name_with_email_address, User, :query_scope => > [:first_name_contains, :last_name_contains] > end > ... > end > > class Assignment < ActiveRecord::Base > hobo_model # Don't put anything above this > > fields do > hours_spent :integer, :default => 0#, :options => > [0,1,2,3,4,5,6,7,8,9] > minutes_spent :integer, :default => 0 > timestamps > end > > # remove from live-search results > set_search_columns nil > > # fields set automatically based on context > never_show :assigned # > http://www.mail-archive.com/[email protected]/msg09518.html > > def name > assigned.name > end > > def type > assigned_type > end > > # default sort > default_scope :order => 'updated_at desc' > > # --- Associations --- # > belongs_to :assignor, :class_name => "User", :creator => true > belongs_to :assignee, :class_name => "User" > belongs_to :assigned, :polymorphic => true > ... > end > > class User < ActiveRecord::Base > > hobo_user_model # Don't put anything above this > > fields do > # name :string, :required #, :login => true > first_name :string, :required > last_name :string, :required > email_address :email_address, :unique, :login => true, :case_sensitive > => false > administrator :boolean, :default => false > timestamps > end > ... > def name > first_name.to_s + ' ' + last_name.to_s > end > > # necessary for autocomplete where user has similar or same name as > another > # and thus uniqueness of user determined by email address > def name_with_email_address > first_name.to_s + ' ' + last_name.to_s + ' (' + email_address.to_s + > ')' > end > > # allow autocomplete to find by name when name is a generated field (see > above) > def self.find_by_name(name) > names = name.split(' ') > (0..(names.length-2)).inject(nil) do |result, n| > result ||= self.find_by_first_name_and_last_name(names[0..n].join(' > '), names[1..(n+1)].join(' ')) > end > end > ... > # default sort EVERYWHERE! > default_scope :order => 'last_name, first_name' > > # --- Associations --- # > has_many :assignments > ... > end > > perusing this group, i continue to see this same issue pop up, so any > insight is much appreciated! ~daVe > > On Thu, Jun 7, 2012 at 11:37 AM, Bryan Larsen <[email protected]> wrote: >> >> Montgomery's email was about a problem with select-one. The "limit" >> attribute has existed on select-one for quite some time now to fix his >> problem. >> >> Your problem is with name-one. It appears that you need to explicitly >> specify the complete-target attribute. If you provide more context I >> can probably help you further. >> >> Bryan >> >> >> On Thu, Jun 7, 2012 at 1:09 PM, d@Ve <[email protected]> wrote: >> > three years on, and i am encountering the same issue when using >> > auto-complete on a new document: >> > >> > ActionController::RoutingError (No route matches >> > "/thiss/complete_user_name") >> > >> > any resolution? ~daVe >> > >> > On Thursday, May 21, 2009 4:29:19 PM UTC-7, Montgomery Kosma wrote: >> >> >> >> Thanks to everyone for all the help, things are moving ahead much more >> >> smoothly for me this evening. >> >> >> >> Already dipping its toes in the production environment, the team as >> >> now defined 217 employees in the app. The oddity is that I'm getting >> >> precisely 101 options in an employee select (generated by a belongs-to >> >> association). In the html, there's one <option value=""> for "None" >> >> followed by <option value=... for the first 100 employees, in alpha >> >> order as required by my set_default_order tag. >> >> >> >> Now, it looks like the SQL being generated to populate the drop-down >> >> is the culprit, as my console window shows: >> >> >> >> SELECT * FROM 'employees' LIMIT 100 >> >> >> >> Where's this 100 coming from -- hobo? rails? More important, how do I >> >> work around it? >> >> >> >> >> >> >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "Hobo Users" group. >> > To view this discussion on the web visit >> > https://groups.google.com/d/msg/hobousers/-/3BzO9GWAlNcJ. >> > 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. >> >> -- >> 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. >> > > -- > 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. -- 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.
