To overwrite an accessor setup by AR you need to use a different syntax
def first_name self[:firstname] = self[:firstname].capitalize_first_letter_method
end
You know though you can do that with css…
HTH
To overwrite an accessor setup by AR you need to use a different syntax
def first_name self[:firstname] = self[:firstname].capitalize_first_letter_method
end
You know though you can do that with css…
HTH
class MyModel < AR::Base before_save :capitalize_fields before_update :capitalize_fields
private def capitalize_fields [:first_name, :last_name].each {|field| self[field] = self[field].capitalize} end end