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 User < ActiveRecord::Base | |
| ... | |
| validates_presence_of :new_column, | |
| # << REMOVE ON NEXT RELASE | |
| if: Proc.new { |o| o.has_attribute?(:new_column) } | |
| # >> REMOVE ON NEXT RELEASE | |
| ... | |
| 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 User < ActiveRecord::Base | |
| ... | |
| # << REMOVE ON NEXT RELASE | |
| def self.columns | |
| super.reject { |c| c.name == "removed_column" } | |
| end | |
| # >> REMOVE ON NEXT RELEASE | |
| ... | |
| 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 AddNewColumnToUsers < ActiveRecord::Migration | |
| def change | |
| add_column :users, :new_column, :text | |
| 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 MigrateFromOldColumnToNewColumn < ActiveRecord::Migration | |
| disable_ddl_transaction! | |
| def up | |
| User.find_in_batches do |mates| | |
| User.where(id: mates.map(&:id)) | |
| .update_all("new_column=old_column") | |
| end | |
| end | |
| def down |
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 RemoveUsersOldColumn < ActiveRecord::Migration | |
| def change | |
| remove_column :users, :old_column | |
| 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 User < ActiveRecord::Base | |
| ... | |
| # << REMOVE ON NEXT RELASE | |
| def new_column | |
| if self.class.column_names.include?("old_column") | |
| self.class.reset_column_information | |
| end | |
| has_attribute?(:old_column) ? old_column : super | |
| 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
| # << REMOVE ON NEXT RELASE | |
| unless NewModel.table_exists? | |
| # Fancy fallback goes here | |
| return | |
| end | |
| # >> REMOVE ON NEXT RELEASE | |
| # Real implementation goes 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
| #!/usr/bin/env ruby | |
| require 'io/console' | |
| require 'octokit' | |
| require 'netrc' | |
| GITHUB_API_URL = "api.github.com" | |
| def clear_github_netrc | |
| n = Netrc.read | |
| n.delete(GITHUB_API_URL) |
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
| require 'celluloid/current' | |
| require 'celluloid/io' | |
| require 'faraday' | |
| require 'benchmark' | |
| URL = 'https://api.wayzup.com' | |
| PATH = '/v1/infos' | |
| ADAPTER = Faraday.default_adapter | |
| ITERATIONS = 20 |
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
| require 'net/https' | |
| require 'nokogiri' | |
| require 'date' | |
| require 'csv' | |
| # PARAMETERS | |
| GOOGLE_ACCOUNT_EMAIL = '<YOUR_GOOGLE_EMAIL>' | |
| GOOGLE_ACCOUNT_PASSWORD = '<YOUR_GOOGLE_PASSWORD>' | |
| SITE_URL = '<WEBSITE_URL>' | |
| CSV_OUTPUT_FILE = "GoogleWebmaster-#{SITE_URL}-crawlErrors.csv" |