action_csv 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.irb_history +5 -0
- data/Gemfile.lock +1 -1
- data/lib/action_csv.rb +2 -1
- data/lib/action_csv/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10da0112b4e38dc497b11442f127a1e3bee478a19f975fc963484a71eed68e71
|
4
|
+
data.tar.gz: 568017d0c3cec0a38f2c0c7658b8251db98923c9fc448cfb9b25ba4171fe7104
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d17eb20257d83ba338ec86cdfd4f709c63ccac8d9cad63f4ab3b29a0eec8c6a47f7131db1606635b1f957cbe903a3e6819980048905235872dc494b64947e070
|
7
|
+
data.tar.gz: 5a281662d284d984d6ed5ead5eb87fabec49bfc0f333bc59a42a2835faea2d2b2a4414731c39bc2770995de78c1f227fdc91c6594d6a36d74dd531596ea588bb
|
data/.irb_history
CHANGED
data/Gemfile.lock
CHANGED
data/lib/action_csv.rb
CHANGED
@@ -2,13 +2,14 @@
|
|
2
2
|
|
3
3
|
require_relative "action_csv/version"
|
4
4
|
require "yaml"
|
5
|
+
require "csv"
|
5
6
|
|
6
7
|
module ActionCsv
|
7
8
|
class Error < StandardError; end
|
8
9
|
COLUMNS = YAML.safe_load_file "./config/column_names.yml"
|
9
10
|
def self.export_csv model_name
|
10
11
|
singularized_name = model_name.singularize.underscore
|
11
|
-
file_dir = "./db/csv"
|
12
|
+
file_dir = "./db/csv/"
|
12
13
|
FileUtils.mkdir_p file_dir unless Dir.exist? file_dir
|
13
14
|
file_path = ENV["RACK_ENV"] == "production" ? "#{file_dir}#{model_name.pluralize.underscore}_production.csv" : "#{file_dir}#{model_name.pluralize.underscore}.csv"
|
14
15
|
CSV.open(file_path, "w") do |csv|
|
data/lib/action_csv/version.rb
CHANGED