Skip to content

Commit

Permalink
Support Rails 6.1.3.2 & 6.0.3.7 (#1972)
Browse files Browse the repository at this point in the history
The security updates bumping Rails for 6.1.3.2 and 6.0.3.7 due to a set
of CVEs also meant we needed to switch to using symbols for polymorphic
routes. This commit bumps the version of Rails dependencies to 6.1.3.2
and also switches to using symbols.
  • Loading branch information
lostmahbles authored May 6, 2021
1 parent abb0790 commit a31b058
Show file tree
Hide file tree
Showing 19 changed files with 76 additions and 76 deletions.
108 changes: 54 additions & 54 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,60 +15,60 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.3.1)
actionpack (= 6.1.3.1)
activesupport (= 6.1.3.1)
actioncable (6.1.3.2)
actionpack (= 6.1.3.2)
activesupport (= 6.1.3.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.3.1)
actionpack (= 6.1.3.1)
activejob (= 6.1.3.1)
activerecord (= 6.1.3.1)
activestorage (= 6.1.3.1)
activesupport (= 6.1.3.1)
actionmailbox (6.1.3.2)
actionpack (= 6.1.3.2)
activejob (= 6.1.3.2)
activerecord (= 6.1.3.2)
activestorage (= 6.1.3.2)
activesupport (= 6.1.3.2)
mail (>= 2.7.1)
actionmailer (6.1.3.1)
actionpack (= 6.1.3.1)
actionview (= 6.1.3.1)
activejob (= 6.1.3.1)
activesupport (= 6.1.3.1)
actionmailer (6.1.3.2)
actionpack (= 6.1.3.2)
actionview (= 6.1.3.2)
activejob (= 6.1.3.2)
activesupport (= 6.1.3.2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.3.1)
actionview (= 6.1.3.1)
activesupport (= 6.1.3.1)
actionpack (6.1.3.2)
actionview (= 6.1.3.2)
activesupport (= 6.1.3.2)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.3.1)
actionpack (= 6.1.3.1)
activerecord (= 6.1.3.1)
activestorage (= 6.1.3.1)
activesupport (= 6.1.3.1)
actiontext (6.1.3.2)
actionpack (= 6.1.3.2)
activerecord (= 6.1.3.2)
activestorage (= 6.1.3.2)
activesupport (= 6.1.3.2)
nokogiri (>= 1.8.5)
actionview (6.1.3.1)
activesupport (= 6.1.3.1)
actionview (6.1.3.2)
activesupport (= 6.1.3.2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.3.1)
activesupport (= 6.1.3.1)
activejob (6.1.3.2)
activesupport (= 6.1.3.2)
globalid (>= 0.3.6)
activemodel (6.1.3.1)
activesupport (= 6.1.3.1)
activerecord (6.1.3.1)
activemodel (= 6.1.3.1)
activesupport (= 6.1.3.1)
activestorage (6.1.3.1)
actionpack (= 6.1.3.1)
activejob (= 6.1.3.1)
activerecord (= 6.1.3.1)
activesupport (= 6.1.3.1)
activemodel (6.1.3.2)
activesupport (= 6.1.3.2)
activerecord (6.1.3.2)
activemodel (= 6.1.3.2)
activesupport (= 6.1.3.2)
activestorage (6.1.3.2)
actionpack (= 6.1.3.2)
activejob (= 6.1.3.2)
activerecord (= 6.1.3.2)
activesupport (= 6.1.3.2)
marcel (~> 1.0.0)
mini_mime (~> 1.0.2)
activesupport (6.1.3.1)
activesupport (6.1.3.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand Down Expand Up @@ -186,7 +186,7 @@ GEM
marcel (1.0.1)
method_source (0.9.2)
mini_mime (1.0.3)
mini_portile2 (2.5.0)
mini_portile2 (2.5.1)
minitest (5.14.4)
momentjs-rails (2.20.1)
railties (>= 3.1)
Expand All @@ -211,20 +211,20 @@ GEM
rack-test (1.1.0)
rack (>= 1.0, < 3)
rack-timeout (0.6.0)
rails (6.1.3.1)
actioncable (= 6.1.3.1)
actionmailbox (= 6.1.3.1)
actionmailer (= 6.1.3.1)
actionpack (= 6.1.3.1)
actiontext (= 6.1.3.1)
actionview (= 6.1.3.1)
activejob (= 6.1.3.1)
activemodel (= 6.1.3.1)
activerecord (= 6.1.3.1)
activestorage (= 6.1.3.1)
activesupport (= 6.1.3.1)
rails (6.1.3.2)
actioncable (= 6.1.3.2)
actionmailbox (= 6.1.3.2)
actionmailer (= 6.1.3.2)
actionpack (= 6.1.3.2)
actiontext (= 6.1.3.2)
actionview (= 6.1.3.2)
activejob (= 6.1.3.2)
activemodel (= 6.1.3.2)
activerecord (= 6.1.3.2)
activestorage (= 6.1.3.2)
activesupport (= 6.1.3.2)
bundler (>= 1.15.0)
railties (= 6.1.3.1)
railties (= 6.1.3.2)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
Expand All @@ -234,9 +234,9 @@ GEM
rails-i18n (6.0.0)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 7)
railties (6.1.3.1)
actionpack (= 6.1.3.1)
activesupport (= 6.1.3.1)
railties (6.1.3.2)
actionpack (= 6.1.3.2)
activesupport (= 6.1.3.2)
method_source
rake (>= 0.8.7)
thor (~> 1.0)
Expand Down
2 changes: 1 addition & 1 deletion app/views/administrate/application/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ It renders the `_table` partial to display details about the resources.
"administrate.actions.new_resource",
name: display_resource_name(page.resource_name, singular: true).downcase
),
[:new, namespace, page.resource_path],
[:new, namespace, page.resource_path.to_sym],
class: "button",
) if valid_action?(:new) && show_action?(:new, new_resource) %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion lib/administrate/namespace.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Administrate
class Namespace
def initialize(namespace)
@namespace = namespace
@namespace = namespace.to_sym
end

def resources
Expand Down
2 changes: 1 addition & 1 deletion lib/administrate/resource_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def dashboard_class
end

def namespace
controller_path.split("/").first
controller_path.split("/").first.to_sym
end

def resource_class
Expand Down
2 changes: 1 addition & 1 deletion lib/administrate/view_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module Administrate
class ViewGenerator < Rails::Generators::Base
include Administrate::GeneratorHelpers
class_option :namespace, type: :string, default: "admin"
class_option :namespace, type: :string, default: :admin

def self.template_source_path
File.expand_path(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DashboardGenerator < Rails::Generators::NamedBase
COLLECTION_ATTRIBUTE_LIMIT = 4
READ_ONLY_ATTRIBUTES = %w[id created_at updated_at]

class_option :namespace, type: :string, default: "admin"
class_option :namespace, type: :string, default: :admin

source_root File.expand_path("../templates", __FILE__)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module <%= namespace.classify %>
class <%= class_name.pluralize %>Controller < <%= namespace.classify %>::ApplicationController
module <%= namespace.to_s.classify %>
class <%= class_name.pluralize %>Controller < <%= namespace.to_s.classify %>::ApplicationController
# Overwrite any of the RESTful controller actions to implement custom behavior
# For example, you may want to send an email after a foo is updated.
#
Expand Down
2 changes: 1 addition & 1 deletion spec/administrate/views/fields/belongs_to/_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
def render_belongs_to_index
render(
partial: "fields/belongs_to/index",
locals: { field: belongs_to, namespace: "admin" },
locals: { field: belongs_to, namespace: :admin },
)
end
end
2 changes: 1 addition & 1 deletion spec/administrate/views/fields/belongs_to/_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
def render_belongs_to_show
render(
partial: "fields/belongs_to/show",
locals: { field: belongs_to, namespace: "admin" },
locals: { field: belongs_to, namespace: :admin },
)
end
end
2 changes: 1 addition & 1 deletion spec/administrate/views/fields/date_time/_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

render(
partial: "fields/date_time/index",
locals: { field: date_time, namespace: "admin" },
locals: { field: date_time, namespace: :admin },
)
end
end
2 changes: 1 addition & 1 deletion spec/administrate/views/fields/has_one/_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

render(
partial: "fields/has_one/index",
locals: { field: has_one, namespace: "admin" },
locals: { field: has_one, namespace: :admin },
)

expected = "<a href=\"#{product_path}\">#{product.name}</a>"
Expand Down
4 changes: 2 additions & 2 deletions spec/administrate/views/fields/has_one/_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
partial: "fields/has_one/show",
locals: {
field: has_one,
namespace: "admin",
namespace: :admin,
resource_name: "product_meta_tag",
},
)
Expand Down Expand Up @@ -93,7 +93,7 @@
partial: "fields/has_one/show",
locals: {
field: has_one,
namespace: "admin",
namespace: :admin,
page: page_double,
resource_name: "product_meta_tag",
},
Expand Down
2 changes: 1 addition & 1 deletion spec/administrate/views/fields/polymorphic/_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

render(
partial: "fields/polymorphic/index",
locals: { field: polymorphic, namespace: "admin" },
locals: { field: polymorphic, namespace: :admin },
)

expected = "<a href=\"#{product_path}\">#{product.name}</a>"
Expand Down
2 changes: 1 addition & 1 deletion spec/administrate/views/fields/polymorphic/_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

render(
partial: "fields/polymorphic/show",
locals: { field: polymorphic, namespace: "admin" },
locals: { field: polymorphic, namespace: :admin },
)

expected = "<a href=\"#{product_path}\">#{product.name}</a>"
Expand Down
2 changes: 1 addition & 1 deletion spec/administrate/views/fields/time/_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
)
render(
partial: "fields/time/index",
locals: { field: time, namespace: "admin" },
locals: { field: time, namespace: :admin },
)

expect(rendered.strip).to eq("12:34PM")
Expand Down
2 changes: 1 addition & 1 deletion spec/administrate/views/fields/url/_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

render(
partial: "fields/url/index",
locals: { field: url, namespace: "admin" },
locals: { field: url, namespace: :admin },
)

expect(rendered).to have_css(
Expand Down
2 changes: 1 addition & 1 deletion spec/administrate/views/fields/url/_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

render(
partial: "fields/url/show",
locals: { field: url, namespace: "admin" },
locals: { field: url, namespace: :admin },
)

expect(rendered).to have_css(
Expand Down
6 changes: 3 additions & 3 deletions spec/generators/views_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
expect(Rails::Generators).
to invoke_generator(
"administrate:views:#{generator}",
[resource, "--namespace", "admin"],
[resource, "--namespace", :admin],
)
end
end
Expand All @@ -27,7 +27,7 @@

expect(Rails::Generators).to invoke_generator(
"administrate:views:index",
[resource, "--namespace", "admin"],
[resource, "--namespace", :admin],
behavior: :revoke,
)
end
Expand All @@ -44,7 +44,7 @@
%w[index show new edit].each do |generator|
expect(Rails::Generators). to invoke_generator(
"administrate:views:#{generator}",
[application_resource_path, "--namespace", "admin"],
[application_resource_path, "--namespace", :admin],
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/administrate/resource_resolver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module Library; class BookDashboard; end; end
it "returns the top-level namespace" do
resolver = Administrate::ResourceResolver.new("foobar/user")

expect(resolver.namespace).to eq("foobar")
expect(resolver.namespace).to eq(:foobar)
end
end

Expand Down

0 comments on commit a31b058

Please sign in to comment.