Make sure the picture is copied with the new profile
This commit is contained in:
parent
dd1786cba4
commit
f14c3bc665
2
Gemfile
2
Gemfile
|
@ -45,6 +45,8 @@ gem 'jquery-datatables-rails'
|
|||
gem 'morrisjs-rails'
|
||||
gem 'raphael-rails'
|
||||
|
||||
gem 'copy_carrierwave_file'
|
||||
|
||||
group :development do
|
||||
gem 'spring'
|
||||
gem 'spring-commands-rspec'
|
||||
|
|
|
@ -100,6 +100,8 @@ GEM
|
|||
execjs
|
||||
coffee-script-source (1.9.1.1)
|
||||
colorize (0.7.7)
|
||||
copy_carrierwave_file (1.1.0)
|
||||
carrierwave (~> 0.9)
|
||||
countries (0.11.5)
|
||||
currencies (~> 0.4.2)
|
||||
i18n_data (~> 0.7.0)
|
||||
|
@ -356,6 +358,7 @@ DEPENDENCIES
|
|||
capybara
|
||||
carrierwave
|
||||
coffee-rails
|
||||
copy_carrierwave_file
|
||||
devise
|
||||
devise-i18n
|
||||
factory_girl_rails
|
||||
|
@ -390,3 +393,6 @@ DEPENDENCIES
|
|||
therubyracer
|
||||
uglifier
|
||||
yaml_db!
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.5
|
||||
|
|
|
@ -21,7 +21,12 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def build_personal_profile(conference, params = {})
|
||||
new_personal_profile = personal_profiles.last.try(:dup) || personal_profiles.build
|
||||
if personal_profiles.last.present?
|
||||
new_personal_profile = personal_profiles.last.try(:dup)
|
||||
CopyCarrierwaveFile::CopyFileService.new(personal_profiles.last, new_personal_profile, :picture).set_file
|
||||
else
|
||||
new_personal_profile = personal_profiles.build
|
||||
end
|
||||
new_personal_profile.conference = conference
|
||||
new_personal_profile.assign_attributes params
|
||||
new_personal_profile
|
||||
|
|
Loading…
Reference in New Issue