Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
veNJOB
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thanh Hung Pham
veNJOB
Commits
ce3dbcdc
Commit
ce3dbcdc
authored
Jul 07, 2017
by
Thanh Hung Pham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload file successful
parent
9ea7fa6a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
app/controllers/confirmations_controller.rb
+1
-1
app/models/user.rb
+3
-3
No files found.
app/controllers/confirmations_controller.rb
View file @
ce3dbcdc
class
ConfirmationsController
<
Devise
::
ConfirmationsController
def
update_confirm
@user
=
User
.
find_by
(
params
[
:user
][
:id
])
@user
.
save_file
(
params
[
:user
][
:cv_name
])
@user
.
skip_password_validation
=
false
@user
.
skip_fullname_validation
=
false
if
@user
.
update_attributes
(
user_params
)
@user
.
save_file
(
params
[
:user
][
:cv_name
])
set_flash_message!
(
:notice
,
:confirmed
)
redirect_to
root_path
else
...
...
app/models/user.rb
View file @
ce3dbcdc
...
...
@@ -19,10 +19,10 @@ class User < ApplicationRecord
name_folder
=
'upload'
new_file_name_with_type
=
"
#{
new_name_file
}
."
+
file_type
image_root
=
"
#{
RAILS
.
root
}
"
upload_root
=
"
#{
Rails
.
root
}
/app/
"
Dir
.
mkdir
(
image
_root
+
"
#{
name_folder
}
"
)
File
.
open
(
image
_root
+
"
#{
name_folder
}
/"
+
new_file_name_with_type
,
'wb'
)
do
|
f
|
Dir
.
mkdir
(
upload
_root
+
"
#{
name_folder
}
"
)
File
.
open
(
upload
_root
+
"
#{
name_folder
}
/"
+
new_file_name_with_type
,
'wb'
)
do
|
f
|
f
.
write
(
file
)
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