I have 2 models
users
models too many The embedded image is
as low as
class user Mongoid :: Document Field: user_name, type: string embeds_im: picture, cascade_kelbox: true ... and
Image
model is implemented as follows
Mogoyade in class picture :: documents include mogaid :: paperclipf Land: Description, type: string is_mangode_tated_file: photo, default_style: '', default_style :: thumb, url: "/: attachment /: id /: style. Extension", style: {origin: ['2000x1200': jpg ], Thumbs: ['600x400 #',: jpg]}, convert_points: {all: '-quality 90-script-background black-flaton + matte'} ... and
Issue User_controller # update
def update ... @ user.update_attributes! (User_params) ... end def user_par Ams params.require (: user) .permit (: user_name, picture: [: id,: description]) end
Expiration of #update
is passed to the description of the picture from the id
... and it does but the uploaded image should not be updated After it has been removed?
How can I update the description
of the uploaded photo @ user.update_attributes! (User_params)
?
Removal after being tested!
image_param = params [: user] .delete (: pictures) @ user.pictures.where (: id.in => pictures_params.map (& id: id)) . Do each. Picture | Pic.set (: description, pictures_params.find {| p | p [: id] == pic.id} [: description]) end
Comments
Post a Comment