Skip to content

Conversation

@marklazz
Copy link

Hi,

I've added 2 commits to the main repo, allowing to:

  • Show custom text for each instance found on the view (by specifying a method name to invoke, instead of just calling an attribute value)
  • Making the options of auto_complete_result html_safe, so that it works well with Rails 3 apps

@rtacconi
Copy link

I tested your version and solved the problem with Rails 3.0.0

…hen used in conjunction with skip_style option
@rajaramyadhav
Copy link

Can you please provide me with the exact steps as to how to use this plugin with Rails 3.0. I am having problems installing the plugin with Rails3.

@marklazz
Copy link
Author

Hi rajarmyadhav,

First of all you need to install the plugin as follows:

rails plugin install --force http://github.com/marklazz/auto_complete.git

Then, will need to setup the controllers as the docs suggests (on https://github.com/marklazz/auto_complete). For example by doing this:

Controller

class BlogController < ApplicationController
auto_complete_for :post, :title
..
end

Then add a route to access that helper defined in the controller, something like this:
..:Application:routes.draw do
..
post "/blog/auto_complete_for_post_title" => "blog#auto_complete_for_post_title"
..
end

Then you can use this view helper to point to that route (or you can specify it via :url parameter):

View

<%= text_field_with_auto_complete :post, :title %>

Then, you'll see it working. Just one minor adjustment left, to see the options fits nicely under the text_box_with_auto_complete you'll probably need to adjust the css with this:

  • {
    margin:0;
    padding:0;
    }

Perhaps you can narrow the styles more than I did, but just to give you a simple solution on a new ralis app.

I'll update the README file with this, because I've just noticed it never mentions about the routes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants