Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not add leading slash to default admin path #1329

Merged
merged 1 commit into from
Jan 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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