seamusabshere-gdocs_bootstrap 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +15 -23
- data/VERSION.yml +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -1,17 +1,13 @@
|
|
1
1
|
= gdocs_bootstrap
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
end
|
7
|
-
</tt>
|
3
|
+
class FuelType
|
4
|
+
gdoc_bootstrap :url => 'http://spreadsheets.google.com/pub?key=p70r3FHguhimIdBKyVz3iPA&output=csv&gid=0'
|
5
|
+
end
|
8
6
|
|
9
7
|
This lets you bootstrap your ActiveRecord models with Google Docs spreadsheets.
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
=> true
|
14
|
-
</tt>
|
9
|
+
>> FuelType.bootstrap!
|
10
|
+
=> true
|
15
11
|
|
16
12
|
== Spreadsheet structure
|
17
13
|
|
@@ -19,25 +15,21 @@ The first column is always the key.
|
|
19
15
|
|
20
16
|
All of the other columns will be included as attributes, based on the column headers.
|
21
17
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
fuel oil 22.51 lbs/gallon
|
27
|
-
</tt>
|
18
|
+
name emission_factor units
|
19
|
+
coal 5246.89 lbs/short ton
|
20
|
+
natural gas 1.25 pounds / therm (nat gas)
|
21
|
+
fuel oil 22.51 lbs/gallon
|
28
22
|
|
29
23
|
would generate
|
30
24
|
|
31
|
-
|
32
|
-
a
|
33
|
-
a.update_attributes(:name => 'coal', :emission_factor => '5246.89', :units => 'lbs/short ton')
|
25
|
+
a = FuelType.find_or_create_by_name('coal')
|
26
|
+
a.update_attributes(:name => 'coal', :emission_factor => '5246.89', :units => 'lbs/short ton')
|
34
27
|
|
35
|
-
a = FuelType.find_or_create_by_name('natural gas')
|
36
|
-
a.update_attributes(:name => 'coal', :emission_factor => '1.25', :units => 'pounds / therm (nat gas)')
|
28
|
+
a = FuelType.find_or_create_by_name('natural gas')
|
29
|
+
a.update_attributes(:name => 'coal', :emission_factor => '1.25', :units => 'pounds / therm (nat gas)')
|
37
30
|
|
38
|
-
a = FuelType.find_or_create_by_name('fuel oil')
|
39
|
-
a.update_attributes(:name => 'coal', :emission_factor => '22.51', :units => 'lbs/gallon')
|
40
|
-
</tt>
|
31
|
+
a = FuelType.find_or_create_by_name('fuel oil')
|
32
|
+
a.update_attributes(:name => 'coal', :emission_factor => '22.51', :units => 'lbs/gallon')
|
41
33
|
|
42
34
|
== Copyright
|
43
35
|
|
data/VERSION.yml
CHANGED