Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
d0a50985
Commit
d0a50985
authored
Jan 08, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create ApplicationSettings if does not exist in runtime
parent
8133e449
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
20 deletions
+24
-20
app/controllers/admin/application_settings_controller.rb
app/controllers/admin/application_settings_controller.rb
+1
-1
app/models/application_setting.rb
app/models/application_setting.rb
+10
-0
config/initializers/8_application_settings.rb
config/initializers/8_application_settings.rb
+0
-11
lib/gitlab/current_settings.rb
lib/gitlab/current_settings.rb
+13
-8
No files found.
app/controllers/admin/application_settings_controller.rb
View file @
d0a50985
...
...
@@ -16,7 +16,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
private
def
set_application_setting
@application_setting
=
ApplicationSetting
.
las
t
@application_setting
=
ApplicationSetting
.
curren
t
end
def
application_setting_params
...
...
app/models/application_setting.rb
View file @
d0a50985
...
...
@@ -2,4 +2,14 @@ class ApplicationSetting < ActiveRecord::Base
def
self
.
current
ApplicationSetting
.
last
end
def
self
.
create_from_defaults
create
(
default_projects_limit:
Settings
.
gitlab
[
'default_projects_limit'
],
signup_enabled:
Settings
.
gitlab
[
'signup_enabled'
],
signin_enabled:
Settings
.
gitlab
[
'signin_enabled'
],
gravatar_enabled:
Settings
.
gravatar
[
'enabled'
],
sign_in_text:
Settings
.
extra
[
'sign_in_text'
],
)
end
end
config/initializers/8_application_settings.rb
deleted
100644 → 0
View file @
8133e449
if
ActiveRecord
::
Base
.
connection
.
table_exists?
(
'application_settings'
)
unless
ApplicationSetting
.
any?
ApplicationSetting
.
create
(
default_projects_limit:
Settings
.
gitlab
[
'default_projects_limit'
],
signup_enabled:
Settings
.
gitlab
[
'signup_enabled'
],
signin_enabled:
Settings
.
gitlab
[
'signin_enabled'
],
gravatar_enabled:
Settings
.
gravatar
[
'enabled'
],
sign_in_text:
Settings
.
extra
[
'sign_in_text'
],
)
end
end
lib/gitlab/current_settings.rb
View file @
d0a50985
...
...
@@ -2,8 +2,14 @@ module Gitlab
module
CurrentSettings
def
current_application_settings
if
ActiveRecord
::
Base
.
connection
.
table_exists?
(
'application_settings'
)
ApplicationSetting
.
current
ApplicationSetting
.
current
||
ApplicationSetting
.
create_from_defaults
else
fake_application_settings
end
end
def
fake_application_settings
OpenStruct
.
new
(
default_projects_limit:
Settings
.
gitlab
[
'default_projects_limit'
],
signup_enabled:
Settings
.
gitlab
[
'signup_enabled'
],
...
...
@@ -13,5 +19,4 @@ module Gitlab
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment