further 0.0.2 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b39a37789c4b6b16cf39285e6a856eda2863046
4
- data.tar.gz: 535aa63ea6fcfe1f55a2d645439b453c9ab75521
3
+ metadata.gz: 54fa66758792626a2f087cd76c8fd09247dff298
4
+ data.tar.gz: a30cb151ac9d877cb3df30218df4b82134b12566
5
5
  SHA512:
6
- metadata.gz: bd4c56f2b5957658c6027f67f07e8d0dc5accb70e9886980acf8c7cc0329d2e0a240f04e4b81db3ae24ecdc30c396b03144516366d8eda68d9dcbcf038d0a362
7
- data.tar.gz: 67d2df2f64b8ee989a363b4ff4aac993047d4a23644fee9cd214c52f84f3ee143c011dd830f2a05c52fee4969dae2a71760a013a0450c42b637400d2457c26ee
6
+ metadata.gz: 2918d66310cd9a39fe3aad68e02b7a08014fe55fc99f62f4dc96e080e00f48242dff8afda133466d3dcfaab07e4e30e73c369003d50f5f80cc283db5c5051a20
7
+ data.tar.gz: 1cbb0d0158d934d1f0d97385f8cf5bebac42fe6a367a2081dfba25fc9603b0515d7b99d6db2511db22294d450cd4b8b5aab5bbb8df340856a9bbd45d331a00b0
@@ -21,20 +21,26 @@ module Further
21
21
  module LocalInstanceMethods
22
22
 
23
23
  def further_info(attributes = {})
24
- if self.further_information.present?
25
- if attributes.present?
26
- self.further_information.update_attributes info: attributes
24
+ further = self.further_information
25
+ info = {}
26
+
27
+ if attributes.present? # Set
28
+
29
+ if further
30
+ attributes.each_pair do |key, value|
31
+ further.info[key] = value
32
+ end
33
+ further.save
27
34
  else
28
- self.further_information.info
29
- end
30
- else
31
- if attributes.present?
32
- info = self.build_further_information info: attributes
33
- info.save
34
- else
35
- {}
35
+ further = self.build_further_information info: attributes
36
+ further.save
36
37
  end
38
+ info = further.info
39
+
40
+ else # Get
41
+ info = further.info if further
37
42
  end
43
+ info
38
44
  end
39
45
 
40
46
  end
@@ -1,3 +1,3 @@
1
1
  module Further
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -0,0 +1,5 @@
1
+ class FurtherInformation < ActiveRecord::Base
2
+ belongs_to :furtherable, polymorphic: true
3
+ store :info
4
+ attr_accessible :info
5
+ end
@@ -0,0 +1,12 @@
1
+ class CreateFurtherInformations < ActiveRecord::Migration
2
+ def change
3
+ create_table :further_informations do |t|
4
+ t.references :furtherable, polymorphic: true
5
+ t.text :info
6
+
7
+ t.timestamps
8
+ end
9
+ add_index :further_informations, :furtherable_id
10
+ add_index :further_informations, :furtherable_type
11
+ end
12
+ end
@@ -311,3 +311,30 @@ Connecting to database specified by database.yml
311
311
  Connecting to database specified by database.yml
312
312
  Connecting to database specified by database.yml
313
313
  Connecting to database specified by database.yml
314
+ Connecting to database specified by database.yml
315
+ Connecting to database specified by database.yml
316
+  (20.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
317
+ Migrating to CreateSites (20131119113259)
318
+  (0.2ms) select sqlite_version(*)
319
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
320
+ Connecting to database specified by database.yml
321
+ Connecting to database specified by database.yml
322
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
323
+ Migrating to CreateSites (20131119113259)
324
+ Migrating to CreateFurtherInformations (20131210101053)
325
+  (0.1ms) select sqlite_version(*)
326
+  (0.2ms) begin transaction
327
+  (0.3ms) CREATE TABLE "further_informations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "furtherable_id" integer, "furtherable_type" varchar(255), "info" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
328
+ SQLite3::SQLException: table "further_informations" already exists: CREATE TABLE "further_informations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "furtherable_id" integer, "furtherable_type" varchar(255), "info" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
329
+  (0.1ms) rollback transaction
330
+ Connecting to database specified by database.yml
331
+ Connecting to database specified by database.yml
332
+ Connecting to database specified by database.yml
333
+ Connecting to database specified by database.yml
334
+ Connecting to database specified by database.yml
335
+ Connecting to database specified by database.yml
336
+ Connecting to database specified by database.yml
337
+ Connecting to database specified by database.yml
338
+ Connecting to database specified by database.yml
339
+ Connecting to database specified by database.yml
340
+ Connecting to database specified by database.yml
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: further
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdulaziz AlShetwi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-01 00:00:00.000000000 Z
11
+ date: 2013-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -63,6 +63,7 @@ files:
63
63
  - test/dummy/app/controllers/sites_controller.rb
64
64
  - test/dummy/app/helpers/application_helper.rb
65
65
  - test/dummy/app/helpers/sites_helper.rb
66
+ - test/dummy/app/models/further_information.rb
66
67
  - test/dummy/app/models/site.rb
67
68
  - test/dummy/app/views/layouts/application.html.erb
68
69
  - test/dummy/app/views/sites/_form.html.erb
@@ -88,6 +89,7 @@ files:
88
89
  - test/dummy/config.ru
89
90
  - test/dummy/db/development.sqlite3
90
91
  - test/dummy/db/migrate/20131119113259_create_sites.rb
92
+ - test/dummy/db/migrate/20131210101053_create_further_informations.rb
91
93
  - test/dummy/db/schema.rb
92
94
  - test/dummy/log/development.log
93
95
  - test/dummy/public/404.html
@@ -136,6 +138,7 @@ test_files:
136
138
  - test/dummy/app/controllers/sites_controller.rb
137
139
  - test/dummy/app/helpers/application_helper.rb
138
140
  - test/dummy/app/helpers/sites_helper.rb
141
+ - test/dummy/app/models/further_information.rb
139
142
  - test/dummy/app/models/site.rb
140
143
  - test/dummy/app/views/layouts/application.html.erb
141
144
  - test/dummy/app/views/sites/_form.html.erb
@@ -161,6 +164,7 @@ test_files:
161
164
  - test/dummy/config.ru
162
165
  - test/dummy/db/development.sqlite3
163
166
  - test/dummy/db/migrate/20131119113259_create_sites.rb
167
+ - test/dummy/db/migrate/20131210101053_create_further_informations.rb
164
168
  - test/dummy/db/schema.rb
165
169
  - test/dummy/log/development.log
166
170
  - test/dummy/public/404.html