Skip to content

Instantly share code, notes, and snippets.

@levent
Created April 22, 2010 13:42
Show Gist options
  • Select an option

  • Save levent/375235 to your computer and use it in GitHub Desktop.

Select an option

Save levent/375235 to your computer and use it in GitHub Desktop.
require 'faker'
# ActiveRecord
# Updates the attribute identified by <tt>attr_name</tt> with the specified +value+. Empty strings for fixnum and float
# columns are turned into +nil+.
def write_attribute(attr_name, value)
attr_name = attr_name.to_s
@attributes_cache.delete(attr_name)
if (column = column_for_attribute(attr_name)) && column.number?
@attributes[attr_name] = convert_number_column_value(value)
else
logger.warn "You know when you've been tango'd."
@attributes[attr_name] = Faker::Lorem.sentence # replace every value with Lorem Ipsum
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment