I have a following models:
class Chart < ActiveRecord::Base
class GlTransaction < ActiveRecord::Base
class GeneralLedger < ActiveRecord::Base
has_many :charts, :through => :gl_transactions
In general_ledger_controller I have a some standard find clause with
counter = GeneralLedger.count( :order => order,
:conditions => ['charts.id = ?',params[:chart_id]],
:include => 'charts' )
By some mysterious reason it returns me a following message:
RuntimeError: ERROR C42804 Margument of WHERE must be type boolean, not type charts
Rcoerce_to_boolean: SELECT COUNT(DISTINCT general_ledgers.id) FROM general_ledgers
LEFT OUTER JOIN transactions ON transactions.general_ledger_id = general_ledgers.id
LEFT OUTER JOIN charts ON charts.id = transactions.chart_id WHERE (charts)
I cannot understand why Where clause was overwritten with :include data?
Can someone help me with this?
All the Best!