scope name with column names fail #117

sbounmy opened this Issue Sep 20, 2010 · 1 comment


None yet
1 participant

sbounmy commented Sep 20, 2010


I have an issue with searchlogic (since 2.4.25).
When trying to loop in an array of method_names with association.send(method_name), sometimes it return searchlogic result instead of the method result !

For example :
def Client
def pdf_methods
[ :city, :zip_code, :full_name, :full_address1_and_2, :full_address1,
:address2, :phone_number, :mobile_number, :fax_number, :email, :lastname,
:firstname, :mr_age, :ms_age, :family_status_human, :mr_pro_status_human, :ms_pro_status_human,
:childrens, :is_tax_credit, :tax_credit, :tax_credit_date, :house, :owner, :construction_under_2_years,
:roof_chimney, :roof_sit_dog, :roof_other, :roof_velux, :roof_slope, :debt_ratio, :pending_credit,
:north, :south, :east, :west, :near_protected_site, :is_renewable_energies_survey, :renewable_energies_survey,
:roof_sheathing_human, :roof_area, :comment_telepro, :couple_present, :zip_code_city

def Appointment
  belongs_to :client

  def to_pdf { |method_name| client.send(method_name) }

Appointment.last.to_pdf #returns an array with method results and searchlogic scope result... => when :owner method_name, i have an array of clients

sbounmy commented Sep 21, 2010

i noticed it calls searchlogic scope column name when we call the attribute from an association using send and if the column is a boolean :
Appointment.last.client.send(:owner) # => SELECT * FROM clients WHERE (clients.owner = 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment