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 ActiveSupport | |
| module Inflector | |
| def pluralize_with_parenthesis(word) | |
| rule, replacement = find_inflections(word, inflections.plurals) | |
| if replacement =~ /\A\w+\Z/ | |
| word.gsub!(rule, "(#{replacement})") | |
| else | |
| pluralize(word) | |
| 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
| desc 'Cleanup tasks' | |
| namespace :clean do | |
| desc 'Clean sessions table (pass DAYS=X default is 30 days)' | |
| task :sessions => :environment do | |
| days = ENV['DAYS'].to_i | |
| days = 30 if days <= 0 | |
| result = ActiveRecord::Base.connection.execute("DELETE FROM sessions WHERE updated_at <= (CURRENT_DATE - INTERVAL '#{days} days')") | |
| affected_rows = result.cmd_tuples | |
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
| def set_locale | |
| if @locale.nil? | |
| I18n.locale = params[:locale] || I18n.default_locale | |
| @locale = I18n.locale.to_sym | |
| end | |
| end | |
| def default_url_options(options = {}) | |
| set_locale if @locale.nil? | |
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
| (function(doc) { | |
| var ref = doc.referrer; | |
| if (ref.match(/google\./gi)) { | |
| var query = ref.split('?')[1], | |
| keyword = '(not provided)', | |
| pathname = doc.location.pathname, | |
| rank = null, | |
| param; | |
| if (query) { |
NewerOlder