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
class User < ActiveRecord::Base | |
validates_presence_of :password, if: :should_validate_password? | |
validates_presence_of :country | |
validates_presence_of :state, if: :in_us? | |
attr_accessor :updating_password | |
def in_us? | |
country == 'US' | |
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
class User < ActiveRecord::Base | |
with_options if: :should_validate_password? do |user| | |
user.validates_presence_of :password | |
user.format_of :password, with: /^[^\s]+$/ | |
end | |
attr_accessor :updating_password | |
def should_validate_password? | |
updating_password || new_record? |
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
// Visit PokeVision.com and select which pokemon you want to see via the filter dropdown. | |
// After you are happy with your selection, open the console[0] while PokeVision.com. | |
// Copy and paste either the save or load code below. | |
// [0] - https://developers.google.com/web/tools/chrome-devtools/debug/console/console-ui?hl=en#open-as-panel | |
// Save selected pokemon | |
var selectedPokemon = []; | |
$('.dropdown-menu.inner li.selected').each(function(_, el){ | |
selectedPokemon.push($(el).data('original-index')); | |
}); |