Skip to content

Commit

Permalink
tech(ActiveModel.types.json): renomme en simple_json pour eviter la c…
Browse files Browse the repository at this point in the history
…onfusion avec ActiveRecord.types.json
  • Loading branch information
Martin committed Oct 19, 2023
1 parent ffdd7ee commit a4ef3cd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/models/chorus_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ class ChorusConfiguration
include ActiveModel::Model
include ActiveModel::Attributes

attribute :centre_de_coup, :json, default: '{}'
attribute :domaine_fonctionnel, :json, default: '{}'
attribute :referentiel_de_programmation, :json, default: '{}'
attribute :centre_de_coup, :simple_json, default: '{}'
attribute :domaine_fonctionnel, :simple_json, default: '{}'
attribute :referentiel_de_programmation, :simple_json, default: '{}'

def format_displayed_value(attribute_name)
case attribute_name
Expand Down
1 change: 0 additions & 1 deletion app/services/api_bretagne_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def fetch_page(url:, params:, retry_count: 1)
end
end


def call(url:, params:)
API::Client.new.(url:, params:, authorization_token:, method:)
end
Expand Down
4 changes: 2 additions & 2 deletions config/initializers/attribute_types.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class JsonType < ActiveModel::Type::Value
class SimpleJsonType < ActiveModel::Type::Value
def cast(value)
return nil if value.blank?
return value if value.is_a?(Hash)
Expand All @@ -8,4 +8,4 @@ def cast(value)
end
end

ActiveModel::Type.register(:json, JsonType)
ActiveModel::Type.register(:simple_json, SimpleJsonType)

0 comments on commit a4ef3cd

Please sign in to comment.