This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails.application.eager_load! | |
ApplicationRecord.descendants.each do |klass| | |
klass.columns.select{ |c| c.type == :boolean }.map(&:name).each do |bool_column| | |
klass.where("#{bool_column} = 't'").update_all(bool_column.to_sym => 1) | |
klass.where("#{bool_column} = 'f'").update_all(bool_column.to_sym => 0) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module FormFieldsHelper | |
def populate_form_fields_from_factory(page, form_id, factory) | |
inputs = page.all(:css, "##{form_id} input, ##{form_id} textarea, ##{form_id} select") | |
inputs.reject{ |input| input[:id] == nil }.each do |input| | |
input_id = input[:id] | |
attribute_name = input_id.gsub("#{factory.class.name.underscore}_",'') | |
attribute = attribute_name.to_sym | |
attribute_value = factory.send(attribute) | |
if input.tag_name == 'select' # Select |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Duo | |
require 'duo/duo_api' # https://github.com/duosecurity/duo_api_ruby | |
extend ActiveSupport::Concern | |
included do | |
def duo_username | |
#whatever... |