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
# Helps you migrate from attachment_fu | |
# put it in your /lib dir and include it your xxxx_uploader.rb | |
module UploaderFu | |
def partition_dir | |
("%08d" % model.id).scan(/\d{4}/).join("/") | |
end | |
def model_dir | |
"#{model.class.to_s.underscore}/#{mounted_as}/" |
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
⨀_⨀ | |
⨂_⨂ | |
(/◔ ◡ ◔)/ | |
°ﺑ° | |
(¬_¬) | |
(´・ω・`) | |
(ʘ_ʘ) | |
(ʘ‿ʘ) | |
(๏̯͡๏ ) | |
(◕_◕) |
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
namespace :locations do | |
desc 'Update the population field of all city locations with the help of a csv file' | |
task :populate_cities, :pop_file, :no_match_file, :needs => :environment do | t , args | | |
raise "Please send a valid CSV File, example: rake locations:populate_cities[pathCVSFile,noMatchFilePath*]" if args[:pop_file].nil? | |
csv_file = args[:pop_file] | |
unmatch_file = args[:no_match_file] || "no_match_location.csv" |
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
namespace :pinow do | |
desc 'Update the population field of all city locations with the help of a csv file' | |
task :populate_cities => :environment do | |
require 'fastercsv' | |
#constants | |
CODE = 0 | |
NAME = 5 | |
STATE_NAME = 6 |
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
#return an array of arrays for the act event logger track changes in content_ui fields | |
# [ profile content real name, "displayed field name: displayed field value"] | |
def content_x_log_array | |
content_ui_log_instructions = (1..20).map {|n| ["content_#{n}", lambda{|value| "#{get_display_name(n)} : #{value}" }} | |
end | |
def get_display_name(n) | |
if template_group.present? && ci = template_group.content_uis.find{|ci| c.generic_field_number == n} | |
ci.field_name.titleize.gsub(/\s+/, '').underscore.to_sym | |
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
#return an array of arrays for the act event logger track changes in content_ui fields | |
# [ profile content real name, "displayed field name: displayed field value"] | |
def content_x_log_array | |
content_ui_log_instructions = (1..20).map {|n| ["content_#{n}", lambda{|value| "#{get_display_name(n)} : #{value}" }} | |
end | |
def get_display_name(n) | |
if template_group.present? && ci = template_group.content_uis.find_by_generic_field_number(n) | |
ci.field_name.titleize.gsub(/\s+/, '').underscore.to_sym | |
end |