home/index.html.erb

<%= form_tag(users_path, :method => "get", id: "search-form") do %>
  <%= text_field_tag :search, params[:search], placeholder: "Search Users" %>
  <%= submit_tag "Search", :name => nil %>
<% end %>

user.rb

def self.search(query)
  where("name like ?", "%#{query}%") 
end

users_controller.rb

def index
  if params[:search]
    @users = User.search(params[:search]).order("created_at DESC")
  else
    @users = User.all.order('created_at DESC')
  end
end

route.rb

  get "/search", to: 'home#index'