Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatible with Rails 3 #9

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Compatible with Rails 3 #9

wants to merge 5 commits into from

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.

None yet

4 participants