ActiveRecord::StatementInvalid: Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= parameters.reference_id (parameters.type = 'HostParameter' ) WHERE ((param' at line 1:
SELECT hosts.* FROM hosts
INNER JOIN parameters ON hosts.id
AND = parameters.reference_id (parameters.type = 'HostParameter' )
WHERE ((parameters.name = 'hostmode') AND (parameters.value = 'development'))
This is obviously incorrect SQL. The ON clause is all jumbled. If I search for either the value or the name then the search works it is just when both host_parameters_value and host_parameters_name are defined together that the problem occurs
Has anyone an idea as to why this is happening or how I might work around it?
I cannot understand what I have done wrong here. Have I defined the associations incorrectly?
if I now do
Host.search( "host_parameters_name_eq"=>"hostmode", "host_parameters_value_eq"=>"development").all.count
then I get this SQL error
ActiveRecord::StatementInvalid: Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= parameters.reference_id (
parameters
.type
= 'HostParameter' ) WHERE ((param' at line 1: SELECThosts
.* FROMhosts
INNER JOINparameters
ON hosts.id AND = parameters.reference_id (parameters
.type
= 'HostParameter' )WHERE ((parameters.name = 'hostmode') AND (parameters.value = 'development'))
This is obviously incorrect SQL. The ON clause is all jumbled. If I search for either the value or the name then the search works it is just when both host_parameters_value and host_parameters_name are defined together that the problem occurs
Has anyone an idea as to why this is happening or how I might work around it?