
problem with modifying example
Reported by salamandyr | April 13th, 2009 @ 10:34 PM
hi, i'm trying just a basic example modified from your binarylogic example pages - selecting conditions doesn't restrict by those conditions, and returns all the results in the database - is this a bug?
app/controllers/searches_controller.rb
class SearchesController < ApplicationController
def index @search = Guitar.new_search(params[:search]) @guitars,
@guitars_count = @search.all, @search.count end end
app/views/index.html.erb:
<% form_for [@search] do |f| %>
<% f.fields_for @search.conditions do |guitars| %>
<%= guitars.label :any, "Match ANY or ALL of the conditions" %><br />
<%= guitars.select :any, [["All", false], ["Any", true]] %><br />
<br />
<%= guitars.label :model_keywords %><br />
<%= guitars.text_field :model_keywords %><br />
<br />
<%= guitars.label :color_keywords %><br />
<%= guitars.text_field :color_keywords %><br />
<br />
<%= guitars.label :serial_ends_with %><br />
<%= guitars.text_field :serial_ends_with %><br />
<br />
<%= f.submit "Search" %>
<% end %>
<% end %>
<% if @guitars_count > 0 %>
<%= @guitars_count %> guitars found
<%= order_by_link :model %> | <%= order_by_link :color %> | <%= order_by_link [:serial, :model] %> |
---|---|---|
<%= guitar.model %> | <%= guitar.color %> | <%= guitar.serial %> |
Per page: <%= per_page_select %>
<% if @search.page_count > 1 %>
No guitars were returned <% end %>
Comments and changes to this ticket
-
Ben Johnson April 16th, 2009 @ 03:06 AM
- State changed from new to open
Sorry for the delay. So conditions aren't being applied at all? You are getting ALL records regardless of the conditions passed?
-
Ben Johnson July 30th, 2009 @ 01:36 PM
- State changed from open to resolved
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Provides common named scopes and object based searching.