Hi there!
I have a following models:
class Chart < ActiveRecord::Base
belongs_to :chart_category
belongs_to :gifi
has_many :gl_transactions
end
class GlTransaction < ActiveRecord::Base
belongs_to :chart
belongs_to :general_ledger
end
class GeneralLedger < ActiveRecord::Base
has_many :gl_transactions
has_many :charts, :through => :gl_transactions
end
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
Fparse_coerce.c L810
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!
Sergey.