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
Boxiang Sun
gitlab-ce
Commits
8f60b5b4
Commit
8f60b5b4
authored
Jun 26, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Group and Event strong_params
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
16a0a4ae
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
11 deletions
+12
-11
app/controllers/admin/groups_controller.rb
app/controllers/admin/groups_controller.rb
+6
-2
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+6
-2
app/models/event.rb
app/models/event.rb
+0
-3
app/models/group.rb
app/models/group.rb
+0
-2
app/models/namespace.rb
app/models/namespace.rb
+0
-2
No files found.
app/controllers/admin/groups_controller.rb
View file @
8f60b5b4
...
...
@@ -20,7 +20,7 @@ class Admin::GroupsController < Admin::ApplicationController
end
def
create
@group
=
Group
.
new
(
params
[
:group
]
)
@group
=
Group
.
new
(
group_params
)
@group
.
path
=
@group
.
name
.
dup
.
parameterize
if
@group
.
name
if
@group
.
save
...
...
@@ -32,7 +32,7 @@ class Admin::GroupsController < Admin::ApplicationController
end
def
update
if
@group
.
update_attributes
(
params
[
:group
]
)
if
@group
.
update_attributes
(
group_params
)
redirect_to
[
:admin
,
@group
],
notice:
'Group was successfully updated.'
else
render
"edit"
...
...
@@ -56,4 +56,8 @@ class Admin::GroupsController < Admin::ApplicationController
def
group
@group
=
Group
.
find_by
(
path:
params
[
:id
])
end
def
group_params
params
.
require
(
:group
).
permit
(
:name
,
:description
,
:path
,
:avatar
)
end
end
app/controllers/groups_controller.rb
View file @
8f60b5b4
...
...
@@ -22,7 +22,7 @@ class GroupsController < ApplicationController
end
def
create
@group
=
Group
.
new
(
params
[
:group
]
)
@group
=
Group
.
new
(
group_params
)
@group
.
path
=
@group
.
name
.
dup
.
parameterize
if
@group
.
name
if
@group
.
save
...
...
@@ -84,7 +84,7 @@ class GroupsController < ApplicationController
end
def
update
if
@group
.
update_attributes
(
params
[
:group
]
)
if
@group
.
update_attributes
(
group_params
)
redirect_to
edit_group_path
(
@group
),
notice:
'Group was successfully updated.'
else
render
action:
"edit"
...
...
@@ -159,4 +159,8 @@ class GroupsController < ApplicationController
params
[
:state
]
=
'opened'
if
params
[
:state
].
blank?
params
[
:group_id
]
=
@group
.
id
end
def
group_params
params
.
require
(
:group
).
permit
(
:name
,
:description
,
:path
,
:avatar
)
end
end
app/models/event.rb
View file @
8f60b5b4
...
...
@@ -15,9 +15,6 @@
#
class
Event
<
ActiveRecord
::
Base
#attr_accessible :project, :action, :data, :author_id, :project_id,
#:target_id, :target_type
default_scope
{
where
.
not
(
author_id:
nil
)
}
CREATED
=
1
...
...
app/models/group.rb
View file @
8f60b5b4
...
...
@@ -20,8 +20,6 @@ class Group < Namespace
has_many
:users_groups
,
dependent: :destroy
has_many
:users
,
through: :users_groups
#attr_accessible :avatar
validate
:avatar_type
,
if:
->
(
user
)
{
user
.
avatar_changed?
}
validates
:avatar
,
file_size:
{
maximum:
100
.
kilobytes
.
to_i
}
...
...
app/models/namespace.rb
View file @
8f60b5b4
...
...
@@ -16,8 +16,6 @@
class
Namespace
<
ActiveRecord
::
Base
include
Gitlab
::
ShellAdapter
#attr_accessible :name, :description, :path
has_many
:projects
,
dependent: :destroy
belongs_to
:owner
,
class_name:
"User"
...
...
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