Skip to content

Commit

Permalink
Rails attributes compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
alecslupu committed Feb 23, 2022
1 parent 8751519 commit 8daa1ad
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions decidim-core/lib/decidim/component_manifest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class ComponentManifest
include ActiveModel::Model
include Decidim::AttributeObject::Model

attribute :admin_engine, Rails::Engine, {}
attribute :engine, Rails::Engine, {}
attribute :admin_engine, Rails::Engine
attribute :engine, Rails::Engine

attribute :name, Symbol
attribute :hooks, Hash[Symbol => Array[Proc]], default: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class ParticipatorySpaceContextManifest
include ActiveModel::Model
include Decidim::AttributeObject::Model

attribute :engine, Rails::Engine, {}
attribute :engine, Rails::Engine
attribute :helper
attribute :layout
end
Expand Down
4 changes: 2 additions & 2 deletions decidim-core/lib/decidim/translatable_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ module TranslatableAttributes
# end
#
# Returns nothing.
def translatable_attribute(name, type, *options)
def translatable_attribute(name, type, **options)
attribute name, Hash[String => Object], default: {}

locales.each do |locale|
attribute_name = "#{name}_#{locale}".gsub("-", "__")
attribute attribute_name, type, *options
attribute attribute_name, type, **options

define_method attribute_name do
field = public_send(name) || {}
Expand Down
2 changes: 1 addition & 1 deletion decidim-core/spec/lib/attribute_object/model_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Decidim
attribute :str, String
attribute :int, Integer
attribute :flt, Float
attribute :eng, Rails::Engine, {}
attribute :eng, Rails::Engine
attribute :arr, Array[OpenStruct]
attribute :hsh, Hash[String => OpenStruct]
end
Expand Down
6 changes: 3 additions & 3 deletions decidim-generators/lib/decidim/generators/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def gem_modifier
@gem_modifier ||= if options[:path]
%(path: "#{options[:path]}")
elsif branch.present?
%(git: "https://github.com/decidim/decidim.git", branch: "#{branch}")
%(git: "https://github.com/tremend-cofe/decidim.git", branch: "#{branch}")
else
%("#{Decidim::Generators.version}")
end
Expand All @@ -261,7 +261,7 @@ def gem_modifier
def branch
return if options[:path]

@branch ||= options[:edge] ? "develop" : options[:branch].presence
@branch ||= options[:edge] ? "ruby-3.0" : options[:branch].presence
end

def app_name
Expand All @@ -286,7 +286,7 @@ def target_gemfile
root = if options[:path]
expanded_path
elsif branch.present?
"https://raw.githubusercontent.com/decidim/decidim/#{branch}/decidim-generators"
"https://raw.githubusercontent.com/tremend-cofe/decidim/#{branch}/decidim-generators"
else
root_path
end
Expand Down
2 changes: 1 addition & 1 deletion decidim-generators/spec/generators_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module Decidim
end

context "with --branch flag" do
let(:default_branch) { "develop" }
let(:default_branch) { "ruby-3.0" }
let(:command) { "decidim --branch #{default_branch} #{test_app}" }

it_behaves_like "a new production application"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class WorkflowManifest
include ActiveModel::Model
include Decidim::AttributeObject::Model

attribute :engine, Rails::Engine, {}
attribute :admin_engine, Rails::Engine, {}
attribute :engine, Rails::Engine
attribute :admin_engine, Rails::Engine
attribute :form, String
attribute :expires_in, ActiveSupport::Duration, default: 0.minutes
attribute :action_authorizer, String
Expand Down

0 comments on commit 8daa1ad

Please sign in to comment.