aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Dober2017-08-03 11:22:27 +0200
committerGitHub2017-08-03 11:22:27 +0200
commitc8eafd43a661e1c75fcdce50744fd79d37344747 (patch)
tree3714b7311e5119aff9816823d06fea71fef11592
parent494fdfab76e6557018de77dac6861513ffa0502b (diff)
parent8b77b96ffa56b14fc94f84b9cffc24a94fc0c13f (diff)
downloadchouette-core-c8eafd43a661e1c75fcdce50744fd79d37344747.tar.bz2
Merge pull request #52 from af83/4216_rename_attributs
4216 rename attributs
-rw-r--r--app/models/clean_up.rb8
-rw-r--r--app/models/line_referential_sync.rb12
-rw-r--r--app/models/stop_area_referential_sync.rb12
-rw-r--r--app/views/line_referentials/show.html.slim4
-rw-r--r--app/views/stop_area_referentials/show.html.slim4
-rw-r--r--db/migrate/20170802141224_rename_message_attributs_to_message_attributes_everywhere.rb10
-rw-r--r--db/schema.rb8
-rw-r--r--spec/factories/clean_up_results.rb9
-rw-r--r--spec/factories/import_messages.rb11
9 files changed, 34 insertions, 44 deletions
diff --git a/app/models/clean_up.rb b/app/models/clean_up.rb
index b1135a155..7aab7f32e 100644
--- a/app/models/clean_up.rb
+++ b/app/models/clean_up.rb
@@ -153,13 +153,13 @@ class CleanUp < ActiveRecord::Base
update_attribute(:started_at, Time.now)
end
- def log_successful message_attributs
+ def log_successful message_attributes
update_attribute(:ended_at, Time.now)
- CleanUpResult.create(clean_up: self, message_key: :successfull, message_attributs: message_attributs)
+ CleanUpResult.create(clean_up: self, message_key: :successfull, message_attributes: message_attributes)
end
- def log_failed message_attributs
+ def log_failed message_attributes
update_attribute(:ended_at, Time.now)
- CleanUpResult.create(clean_up: self, message_key: :failed, message_attributs: message_attributs)
+ CleanUpResult.create(clean_up: self, message_key: :failed, message_attributes: message_attributes)
end
end
diff --git a/app/models/line_referential_sync.rb b/app/models/line_referential_sync.rb
index 6730ddd73..75c1e48a2 100644
--- a/app/models/line_referential_sync.rb
+++ b/app/models/line_referential_sync.rb
@@ -40,11 +40,11 @@ class LineReferentialSync < ActiveRecord::Base
end
end
- def create_sync_message criticity, key, message_attributs = {}
+ def create_sync_message criticity, key, message_attributes = {}
params = {
criticity: criticity,
message_key: key,
- message_attributs: message_attributs
+ message_attributes: message_attributes
}
line_referential_sync_messages.create params
end
@@ -54,13 +54,13 @@ class LineReferentialSync < ActiveRecord::Base
create_sync_message :info, :pending
end
- def log_successful message_attributs
+ def log_successful message_attributes
update_attribute(:ended_at, Time.now)
- create_sync_message :info, :successful, message_attributs
+ create_sync_message :info, :successful, message_attributes
end
- def log_failed message_attributs
+ def log_failed message_attributes
update_attribute(:ended_at, Time.now)
- create_sync_message :error, :failed, message_attributs
+ create_sync_message :error, :failed, message_attributes
end
end
diff --git a/app/models/stop_area_referential_sync.rb b/app/models/stop_area_referential_sync.rb
index 0e32df4d2..e6cf2ecbc 100644
--- a/app/models/stop_area_referential_sync.rb
+++ b/app/models/stop_area_referential_sync.rb
@@ -40,11 +40,11 @@ class StopAreaReferentialSync < ActiveRecord::Base
end
end
- def create_sync_message criticity, key, message_attributs = {}
+ def create_sync_message criticity, key, message_attributes = {}
params = {
criticity: criticity,
message_key: key,
- message_attributs: message_attributs
+ message_attributes: message_attributes
}
stop_area_referential_sync_messages.create params
end
@@ -54,13 +54,13 @@ class StopAreaReferentialSync < ActiveRecord::Base
create_sync_message :info, :pending
end
- def log_successful message_attributs
+ def log_successful message_attributes
update_attribute(:ended_at, Time.now)
- create_sync_message :info, :successful, message_attributs
+ create_sync_message :info, :successful, message_attributes
end
- def log_failed message_attributs
+ def log_failed message_attributes
update_attribute(:ended_at, Time.now)
- create_sync_message :error, :failed, message_attributs
+ create_sync_message :error, :failed, message_attributes
end
end
diff --git a/app/views/line_referentials/show.html.slim b/app/views/line_referentials/show.html.slim
index 95c2c02b0..e2381e7e9 100644
--- a/app/views/line_referentials/show.html.slim
+++ b/app/views/line_referentials/show.html.slim
@@ -44,6 +44,6 @@
td.text-center
.fa.fa-circle class="text-#{criticity_class(log.criticity)}"
td
- - data = log.message_attributs.symbolize_keys!
+ - data = log.message_attributes.symbolize_keys!
- data[:processing_time] = distance_of_time_in_words(data[:processing_time].to_i)
- = t("line_referential_sync.message.#{log.message_key}", log.message_attributs.symbolize_keys!).html_safe
+ = t("line_referential_sync.message.#{log.message_key}", log.message_attributes.symbolize_keys!).html_safe
diff --git a/app/views/stop_area_referentials/show.html.slim b/app/views/stop_area_referentials/show.html.slim
index 56ecbf6da..0fca15fff 100644
--- a/app/views/stop_area_referentials/show.html.slim
+++ b/app/views/stop_area_referentials/show.html.slim
@@ -37,6 +37,6 @@
td.text-center
.fa.fa-circle class="text-#{criticity_class(log.criticity)}"
td
- - data = log.message_attributs.symbolize_keys!
+ - data = log.message_attributes.symbolize_keys!
- data[:processing_time] = distance_of_time_in_words(data[:processing_time].to_i)
- = t("stop_area_referential_sync.message.#{log.message_key}", log.message_attributs.symbolize_keys!).html_safe
+ = t("stop_area_referential_sync.message.#{log.message_key}", log.message_attributes.symbolize_keys!).html_safe
diff --git a/db/migrate/20170802141224_rename_message_attributs_to_message_attributes_everywhere.rb b/db/migrate/20170802141224_rename_message_attributs_to_message_attributes_everywhere.rb
new file mode 100644
index 000000000..2ac0ae1a7
--- /dev/null
+++ b/db/migrate/20170802141224_rename_message_attributs_to_message_attributes_everywhere.rb
@@ -0,0 +1,10 @@
+class RenameMessageAttributsToMessageAttributesEverywhere < ActiveRecord::Migration
+ def change
+ # -- for table in cleanup_results import_messages line_referential_sync_messages stop_area_referential_sync_messages
+ # rename_column :table, :message_attributs, :message_attributes
+ # rename_column :cleanup_results, :message_attributs, :message_attributes
+ rename_column :import_messages, :message_attributs, :message_attributes
+ rename_column :line_referential_sync_messages, :message_attributs, :message_attributes
+ rename_column :stop_area_referential_sync_messages, :message_attributs, :message_attributes
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 05f5c2e87..e839edf86 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20170727130705) do
+ActiveRecord::Schema.define(version: 20170802141224) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -247,7 +247,7 @@ ActiveRecord::Schema.define(version: 20170727130705) do
create_table "import_messages", id: :bigserial, force: :cascade do |t|
t.integer "criticity"
t.string "message_key"
- t.hstore "message_attributs"
+ t.hstore "message_attributes"
t.integer "import_id", limit: 8
t.integer "resource_id", limit: 8
t.datetime "created_at"
@@ -355,7 +355,7 @@ ActiveRecord::Schema.define(version: 20170727130705) do
create_table "line_referential_sync_messages", id: :bigserial, force: :cascade do |t|
t.integer "criticity"
t.string "message_key"
- t.hstore "message_attributs"
+ t.hstore "message_attributes"
t.integer "line_referential_sync_id", limit: 8
t.datetime "created_at"
t.datetime "updated_at"
@@ -580,7 +580,7 @@ ActiveRecord::Schema.define(version: 20170727130705) do
create_table "stop_area_referential_sync_messages", id: :bigserial, force: :cascade do |t|
t.integer "criticity"
t.string "message_key"
- t.hstore "message_attributs"
+ t.hstore "message_attributes"
t.integer "stop_area_referential_sync_id", limit: 8
t.datetime "created_at"
t.datetime "updated_at"
diff --git a/spec/factories/clean_up_results.rb b/spec/factories/clean_up_results.rb
deleted file mode 100644
index 6d3818eff..000000000
--- a/spec/factories/clean_up_results.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-FactoryGirl.define do
- factory :clean_up_result do
- criticity 1
-message_key "MyString"
-message_attributs ""
-cleanup nil
- end
-
-end
diff --git a/spec/factories/import_messages.rb b/spec/factories/import_messages.rb
deleted file mode 100644
index 1101107d2..000000000
--- a/spec/factories/import_messages.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-FactoryGirl.define do
- factory :import_message do
- criticity 1
- message_key "MyString"
- message_attributs ""
- import nil
- resource nil
- resource_attributes {}
- end
-
-end