Codeplace | Advanced Search Form with Ruby on Rails

Codeplace · 41K views · 2015 · 13:57

Open on YouTube

Web developmentPython, Ruby & scripting languagestutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as a starting point when they are building search forms in Rails and want a worked example to follow.

Recommended by 2 people across 2 different months, 2016 to 2018.

What it is

A short Codeplace tutorial that walks through building an advanced search form in a Ruby on Rails app, with source files and an ASCIIcast available on the Codeplace site. It is aimed at people learning Rails who want filterable search beyond a basic keyword box.

What people said

Recommends aprok · 2016-03 · Stack Overflow · on “Search with Ruby on Rails”

Try looking through this code: In your html: <% form_tag projects_path, :method => 'get' do %> <p> <%= text_field_tag :search, params[:search] %> <%= submit_tag "Search", :name => nil %> </p> <% end %> In your controller: def index @projects = Project.search(params[:search]) end and in the model def self.search(search) if search find(:all, :conditions => ['name LIKE ?', "%#{search}%"]) else find(:all) end end Here is the link [LINK] Also as I'm doing in my project, you can create separate action in your index/welcome controller called search: def search end Then configure route in your routes.rb like so(not sure exactly this will work) get 'welcome/' => 'welcom#search', as: 'search' And then

Recommends Aly Dabbous · 2018-05 · Stack Overflow · on “Advanced Search with Rails”

I'm creating an advanced search feature on my rails application. I want to add a functionality where I can search and filter based on the user's name and gender. I did this by adding a new model called the search model with two columns: username & gender. I took the inspiration from this video [this video] , and this link [LINK] , but customised the feature greatly to fit my needs for the application. Until now, everything flows successfully, by this I mean that as an admin of the page I can successfully navigate between the two index's of the different models: the users model and the search model. The only problem is that I'm struggling to capture my params (what is being searched) and save it i

Cites Piotr Dołęga · 2016-11 · Stack Overflow · on “Searching two databases in Ruby on Rails”

I need to search two databases in Ruby on Rails. Both are about books: name, ISBN, and price. I need to search both at the same request. Is it possible? I have already made app which is searching one database. Here [this video] is tutorial that I followed.