Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8427563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:48:51+00:00 2026-06-10T04:48:51+00:00

Good day. I hame a controller that uses ransack to find articles by their

  • 0

Good day.
I hame a controller that uses ransack to find articles by their title.
I need field that’s used for finding info to use autocomplete.
Currently it finds alright, but no autocomplete, could you assist me in that problem
and gem https://github.com/crowdint/rails3-jquery-autocomplete-app?

Gemfile

 gem "ransack"
    gem 'rails3-jquery-autocomplete'
    gem 'nifty-generators'
    gem 'jquery-rails', '~> 2.0'

in view:

<%= search_form_for @q do |f| %>
  <%= f.label t('.find') %>
  <%= f.autocomplete_field :title_cont,
    articles_autocomplete_article_title_path, :size => 15 %><br />
  <%= f.submit :value=>'Search', :class=>'fl_right' %>
<% end %>

head of layout:

 <%= stylesheet_link_tag    "application", :media => "all" %>
  <%= javascript_include_tag "application" %>
      <%= javascript_include_tag '/javascripts/jquery-ui-1.8.23.custom.min.js',
      '/javascripts/autocomplete-rails.js', '/javascripts/rails.js'  %>
    <%= stylesheet_link_tag '/stylesheets/ui-lightness/jquery-ui-1.8.23.custom.css' %>

controller

class ArticlesController < ApplicationController
  autocomplete :article, :title

UPDATE 1
and routes.rb

get 'articles/autocomplete_article_title'

UPDATE 2
in view , in place of <%= f.autocomplete_field :title_cont,
used
1 ) :title_start no changes
2) :articles_article_title_start and so on lead to errors.

UPDATE 3
i’ve edited routes.rb. moved get ‘articles/autocomplete_article_title’ into scope of locale variable, now it kind of works... autocomplete drop down list appears… but empty 🙁 have to fix that one now.

UPDATE 4
tried to use http://railscasts.com/episodes/102-auto-complete-association. but it’s for older version of rails… and so on

UPDATE 5
changed in routes.rb

  resources :articles do
    get 'autocomplete_article_title'
  end

No luck yet.

UPDATE 6
As far as i understand current problem is: ransack & autocomplete use one field.
It’s suitable for ransack that field of autocomplete_field type. but i don’t know how to make field name acceptable by ransack work with autocomplete. Could you help?

UPDATE 7
so in view

   f.text_field :title_start,
      "data-autocomplete" => articles_autocomplete_article_title_path,
      :size => 15

in routes.rb

scope '(:locale)' do
  resources :users
  resources :news
  resources :articles do

  end
  get 'articles/autocomplete_article_title'
  get "news/index" , as: 'news'

# match "/news*tail" => 'news#index'
  root :to => 'News#index', as: 'news'
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T04:48:52+00:00Added an answer on June 10, 2026 at 4:48 am

    Instead of

    f.autocomplete_field :title_cont,
        articles_autocomplete_article_title_path, :size => 15 
    

    Try

    f.text_field :title_cont, "data-autocomplete" => articles_autocomplete_article_title_path
    

    In my project i used meta_search and simple_form and it was like

    f.input :country_name_equals, url: autocomplete_country_name_path, :as => :autocomplete
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good day. I need to teach Windows CryptoAPI to encrypt the message with private
Good day, I have a class that implements the LoaderCallbacks, and hence have the
Good day I have a custom TextBox that has a IndicatorTextBox.ui.xml file as well
Good day, I have like 15 images I need to be buttons. I have
Good day, all. I know that this is a pretty basic question in terms
Good Day, I have a simple working routine in Perl that swaps two words:
Good day everyone, this is one of those areas that is a little over
Good Day! I am tying to add keyevent listener to jTextField so that if
Good day! I've a model that is binded from JSON request, say like this:
Good day, everyone. I need a compiled and ready-to-use Flash lib, which is able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.