Answer the question
In order to leave comments, you need to log in
How to filter objects in rails?
There is a filter on the page with different parameters, I use gem 'ransack'
controller
def index
@search = Restaurant.search(params[:q])
@restaurants = @search.result.where(:publish => true, :status => 1)
end
<%= search_form_for @search, id: 'catalog_filter' do |f| %>
...
<% end %>
<div class="slider"></div>
<%= f.search_field :check, id: 'hidden' %>
$(".slider" ).slider({
animate: true,
range: "min",
value: 970,
min: 250,
max: 2700,
step: 1,
slide: function( event, ui ) {
$( "#slider-result" ).html( ui.value );
},
change: function(event, ui) {
$('#hidden').attr('value', ui.value);
}
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question