Skip to content

Commit

Permalink
Merge pull request #1329 from tvdeyen/fix/1244
Browse files Browse the repository at this point in the history
Do not add leading slash to default admin path
  • Loading branch information
tvdeyen authored Jan 9, 2018
2 parents b759021 + 5f46a4f commit 65f67e2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ For example, these settings:
```ruby
# config/initializers/alchemy.rb

Alchemy.admin_path = '/backend'
Alchemy.admin_path = 'backend'
Alchemy.admin_constraints = {subdomain: 'hidden'}
```

Expand Down
10 changes: 5 additions & 5 deletions lib/alchemy/paths.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Alchemy has some defaults for admin path and admin constraints:
#
# +Alchemy.admin_path defaults to +'/admin'+
# +Alchemy.admin_path defaults to +'admin'+
# +Alchemy.admin_constraints defaults to +{}+
#
# Anyway, you can tell Alchemy about your routing configuration:
Expand All @@ -17,18 +17,18 @@
#
# == Example
#
# If you do not wish to use the default admin interface routing ('example.com/admin/')
# and prefer e.g. 'hidden.example.com/backend/', those are the settings you need:
# If you do not wish to use the default admin interface routing ('example.com/admin')
# and prefer e.g. 'hidden.example.com/backend', those are the settings you need:
#
# # config/initializers/alchemy.rb
# Alchemy.admin_path = '/backend'
# Alchemy.admin_path = 'backend'
# Alchemy.admin_constraints = {subdomain: 'hidden'}
#
module Alchemy
mattr_accessor :admin_path, :admin_constraints

# Defaults
#
@@admin_path = '/admin'
@@admin_path = 'admin'
@@admin_constraints = {}
end
2 changes: 1 addition & 1 deletion spec/libraries/paths_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Alchemy
describe 'Paths' do
describe 'defaults' do
it 'has default value for Alchemy.admin_path' do
expect(Alchemy.admin_path).to eq('/admin')
expect(Alchemy.admin_path).to eq('admin')
end

it 'has default value for Alchemy.admin_constraints' do
Expand Down
4 changes: 2 additions & 2 deletions spec/routing/routing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@

context "customized" do
before(:all) do
Alchemy.admin_path = "/backend"
Alchemy.admin_path = "backend"
Alchemy.admin_constraints = {subdomain: "hidden"}
Rails.application.reload_routes!
end
Expand All @@ -232,7 +232,7 @@
end

after(:all) do
Alchemy.admin_path = "/admin"
Alchemy.admin_path = "admin"
Alchemy.admin_constraints = {}
Rails.application.reload_routes!
end
Expand Down

0 comments on commit 65f67e2

Please sign in to comment.