slim_scrooge
slim_scrooge copied to clipboard
read_attribute doesnt work with Rails 3.2.15
I have a code in model to update column to have custom text appended.
def name read_attribute(:name) + " (N)" if read_attribute(:name).present? end
Its not working with this plugin. Is it bcas its not compatible with rails 3.2 or I can fix it with minor code change?
ActiveRecord::StatementInvalid - Mysql2::Error: Unknown column '174' in 'where clause': SELECT markets
.name
,markets
.division_id
,markets
.active
,markets
.creator_id
,markets
.updater_id
,markets
.created_at
,markets
.updated_at
,markets
.market_type
,markets
.short_name
,markets
.time_zone_id
,markets
.region_id
,markets
.country_id
,markets
.state_id
,markets
.id
FROM markets
WHERE id
IN (174
,197
):
activerecord (3.2.15) lib/active_record/connection_adapters/abstract_adapter.rb:285:in rescue in log' activerecord (3.2.15) lib/active_record/connection_adapters/abstract_adapter.rb:280:in
log'
activerecord (3.2.15) lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in execute' activerecord (3.2.15) lib/active_record/connection_adapters/mysql2_adapter.rb:213:in
execute'
activerecord (3.2.15) lib/active_record/connection_adapters/mysql2_adapter.rb:217:in exec_query' activerecord (3.2.15) lib/active_record/connection_adapters/mysql2_adapter.rb:226:in
select'
slim_scrooge (1.0.14) lib/slim_scrooge/result_set.rb:29:in reload!' slim_scrooge (1.0.14) lib/slim_scrooge/monitored_hash.rb:32:in
new_column_access'
slim_scrooge (1.0.14) lib/slim_scrooge/monitored_hash.rb:19:in `block in []'
Clearly something wrong with the sql statement - this isn't maintained any longer, but please feel free to fork / fix.
SQl statement is built wrong as its putting 174 id in quote like '174' any pointers where to update the SQL generation would be good I can update the code then.