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
# rails initializer to load *.ini into Rails.application.config | |
Dir.glob(File.join Rails.root, "/config/**/*.ini").each do |file_name| | |
config_name = File.basename(file_name, ".ini") | |
Rails.application.config.send "#{config_name}=", IniFile.new(file_name).to_struct.send(Rails.env) | |
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
module Vienna | |
module Sorting | |
module ClassMethods | |
def sorted_by(field, options = {}) | |
@_sort_field = field | |
@_sort_descending = options.fetch(:order, "asc") != 'asc' | |
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
# encoding: utf-8 | |
class Object | |
# An object is blank if it's false, empty, or a whitespace string. | |
# For example, '', ' ', +nil+, [], and {} are all blank. | |
# | |
# This simplifies: | |
# | |
# if address.nil? || address.empty? | |
# |
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 Vienna | |
module Ajax | |
module ClassMethods | |
def url(url = nil) | |
url ? @_url = url : @_url | |
end | |
def from_form(form) |
NewerOlder