Skip to content

Instantly share code, notes, and snippets.

View ffortin's full-sized avatar

Francois Fortin ffortin

  • Samsung
  • Montreal
View GitHub Profile
@ffortin
ffortin / test_hstore_accessor_dup.rb
Created September 24, 2014 15:16
Test fails on store_accessor dup
require 'bundler'
Bundler.setup(:default)
require 'active_record'
require 'minitest/autorun'
require 'logger'
ActiveRecord::Base.logger = Logger.new(STDOUT)
class Contact < ActiveRecord::Base
#
# At CoverHound, we use conditional validations all over the form. However, there is no proper way to do
# this in Rails. Instead, we can provide an array of attributes (validated_fields attribute)
# and ensure they are the only ones to get validated.
#
module ConditionalValidations
attr_accessor :validated_fields
def field_is_required?(field)