Your problem is that crawlers are case sensitive. I have the same problem with my old database.
Try to see how it works:
Person.find_by_Last_Name("Smith")
That should do the trick.
I have some code that I wrote to fix such problems. This is a small monkey palette for ActiveRecord that you can insert into specific models that you want to change.
module ActiveRecord
class Base
cattr_accessor :downcase_legacy_field_names, :instance_writer => false
@@downcase_legacy_field_names = false
end
end
ActiveRecord, downcase_legacy_field_names. false. true , .
class << ActiveRecord::Base
def column_methods_hash
@dynamic_methods_hash ||= column_names.inject(Hash.new(false)) do |methods, attr|
attr_final = downcase_legacy_field_names ? attr.to_s.downcase : attr
attr_name = attr_final
methods[attr_final.to_sym] = attr_name
methods["#{attr_final}=".to_sym] = attr_name
methods["#{attr_final}?".to_sym] = attr_name
methods["#{attr_final}_before_type_cast".to_sym] = attr_name
methods
end
end
def downcase_legacy_field_methods
column_names.each do |name|
next if name == primary_key
a = name.to_s.underscore
define_method(a.to_sym) do
read_attribute(name)
end
define_method("#{a}=".to_sym) do |value|
write_attribute(name, value)
end
define_method("#{a}?".to_sym) do
self.send("#{name}?".to_sym)
end
end
end
end
ActiveRecord::Base.downcase_legacy_field_names = true
: http://wiki.rubyonrails.org/rails/pages/HowToUseLegacySchemas
column_methods_hash
ActiveRecord. , . - , ActiveRecord ( ) SQL .
downcase_legacy_field_methods
- , , downcase.d.
ActiveRecord. , ActiveRecord. environment.rb.
ActiveRecord, . downcase_legacy_field_methods
. :
class LegacyDatabaseModel < ActiveRecord::Base
downcase_legacy_field_methods
def cubits_to_feet
end
end