Skip to content

Commit

Permalink
Move the root definition to the end of the list
Browse files Browse the repository at this point in the history
  • Loading branch information
netikular committed Apr 18, 2024
1 parent 2bb0b16 commit 820cef9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
20 changes: 9 additions & 11 deletions lib/dato_cms_graphql/rails/routing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ def self.draw_routes(base_class)
::Rails.application.routes.draw do
scope "(:locale)", locale: I18n.default_locale do
# Queries that represent collections of pages.
DatoCmsGraphql.renderable.each do |query|
DatoCmsGraphql.renderable.select { |q| !q.route.blank? }.each do |query|
controller = query.plural_name.underscore

if query.route.blank?
next
else
get(
query.route,
to: "#{controller}#show",
constraints: lambda { |request| base_class.allow?(query.query_name, request) }
)
end
get(
query.route,
to: "#{controller}#show",
constraints: lambda { |request| base_class.allow?(query.query_name, request) }
)
end

home = DatoCmsGraphql.renderable.find { |q| q.route.blank? }
root "#{home.plural_name.underscore}#show"
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/dato_cms_graphql/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module DatoCmsGraphql
VERSION = "0.2.6"
VERSION = "0.2.7"
end

0 comments on commit 820cef9

Please sign in to comment.