This file contains hidden or 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
| git config --global alias.hist "log --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(red)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --graph --date=short" |
This file contains hidden or 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
| # Run from the directory containing the app | |
| # Given the app name | |
| # Iterates over the models and replaces attr_accessible with strong params in the assocated controller | |
| require 'active_support/inflector' | |
| app_name = ARGV.first | |
| models = Dir.entries("#{app_name}/app/models/").reject {|name| ['.', '..', '.gitkeep', 'permission.rb', 'user.rb'].include? name }.map {|name| name.split('.').first} | |
| models.each do |model_name| | |
| model_file_name = "#{app_name}/app/models/#{model_name}.rb" |
This file contains hidden or 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 StripeElementsUtils | |
| def fill_stripe_elements(card_number) | |
| fill_stripe_element do | |
| card_number.to_s.chars.each do |piece| | |
| find_field('cardnumber').send_keys(piece) | |
| end | |
| find_field('exp-date').send_keys("0122") | |
| find_field('cvc').send_keys '123' | |
| find_field('postal').send_keys '19335' |
This file contains hidden or 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
| before_action :fix_ie_params, only: [:create] | |
| def fix_ie_params | |
| unless params.has_key?(:my_missing_param) | |
| begin | |
| request.body.rewind | |
| params.merge! ActiveSupport::JSON.decode(request.body.read) | |
| rescue Exception=>e | |
| Rails.logger.warn "[#{self.class}] #{e.message}" |