Thanks,
That will give me what I want. On thing I notice is that the search result
brings up anything found with the matching characters, not just something
that starts with what I type. I actually like that better than what I
planned, but if I wanted to limit it to just the starting characters of a
name field, is there a way to filter it that way?
Jim
On Friday, May 4, 2012 5:56:46 AM UTC-6, Matt jones wrote:
>
>
> On May 3, 2012, at 9:22 PM, jhstephenson wrote:
>
> > Ok. Here is what the log shows when I try do it on just my Category
> field:
> >
> > Started GET "/categories/complete_name?query=Computer" for 127.0.0.1 at
> 2012-05-03 19:18:24 -0600
> > [1m [36mSQL (2.0ms) [0m [1mSHOW TABLES [0m
> > [1m [35mSQL (1.0ms) [0m SHOW TABLES
> > [1m [36mSQL (2.0ms) [0m [1mSHOW TABLES [0m
> > [1m [35mSQL (1.0ms) [0m SHOW TABLES
> > [1m [36mSQL (1.0ms) [0m [1mSHOW TABLES [0m
> > [1m [35mSQL (2.0ms) [0m SHOW TABLES
> > [1m [36mSQL (2.0ms) [0m [1mSHOW TABLES [0m
> > Processing by CategoriesController#show as JS
> > Parameters: {"query"=>"Computer", "id"=>"complete_name"}
> > [1m [35mSQL (1.0ms) [0m SELECT COUNT(*) AS count_id FROM `users`
> > [1m [36mUser Load (1.0ms) [0m [1mSELECT `users`.* FROM `users` WHERE
> (`users`.`id` = 1) LIMIT 1 [0m
> > [1m [35mCategory Load (0.0ms) [0m SELECT `categories`.* FROM
> `categories` WHERE (`categories`.`id` = 0) LIMIT 1
> > Completed in 20ms
> >
> > ActiveRecord::RecordNotFound (Couldn't find Category with
> ID=complete_name):
> >
> >
> > Rendered
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb
>
> (1.0ms)
> > Rendered
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb
>
> (3.0ms)
> > Rendered
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb
>
> within rescues/layout (16.0ms)
> >
> > I assume the key entry here is the one indicating that ActiveRecord
> could not fine the Category with ID=complete_name.
> > Should there be a method in the Category controller called
> complete_name?
>
> Yep. The quickest way to get one is with the autocomplete method:
>
> http://cookbook.hobocentral.net/manual/controllers#autocompleters
>
> --Matt Jones
--
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/-/dGV-rzhOKBgJ.
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.