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
| upstream example_name { | |
| server unix:///var/www/example_name/shared/sockets/puma.sock; | |
| } | |
| server { | |
| listen 80; | |
| server_name example_name.com; | |
| root /var/www/example_name/current/public; | |
| location / { |
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
| # Countries | |
| # `alpha2_code` has unique constraint | |
| countries_seed_file = File.join(Rails.root, 'db', 'seeds', 'countries.yml') | |
| countries = YAML.load_file(countries_seed_file) | |
| countries.each do |country| | |
| country = country[-1] | |
| data = { | |
| name: country['name'], | |
| continent: country['continent'], |
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
| ------------ From Rake Task | |
| namespace :app do | |
| # Checks and ensures task is not run in production. | |
| task :ensure_development_environment => :environment do | |
| if Rails.env.production? | |
| raise "\nI'm sorry, I can't do that.\n(You're asking me to drop your production database.)" | |
| end | |
| end |
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
| class Hash | |
| # Extension of the `key?` method to check for existence of multiple keys in | |
| # a hash. | |
| # | |
| # Returns true if all keys matches, false if hash has missing keys. | |
| # Returns true if hash has more keys than specified in array. | |
| def keys?(array) | |
| !array.map { |k| self.key?(k) }.include? false | |
| end | |
| end |
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
| # A list of possible usernames to reserve to avoid | |
| # vanity URL collision with resource paths | |
| # It is a merged list of the recommendations from this Quora discussion: | |
| # http://www.quora.com/How-do-sites-prevent-vanity-URLs-from-colliding-with-future-features | |
| # Country TLDs found here: | |
| # http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains | |
| # Languages found here: |
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
| # app/models/concerns/multiparameter_attribute_assignment.rb | |
| module MultiparameterAttributeAssignment | |
| include ActiveModel::ForbiddenAttributesProtection | |
| def initialize(params = {}) | |
| assign_attributes(params) | |
| end | |
| def assign_attributes(new_attributes) |
OlderNewer