Rails let user upload photo with carrierwave -


i have entity lead. want able upload picture , save path status_photo field. use carrierwave gem photo uploads.

in model i've mounted mount_uploader :status_photo, photouploader (my photouploader works problem code in controller or view)

right have form editing lead.

<%= form_for(@lead) |f| %>      phone: <%= @lead.phone %>     .     .     .     status: <%= select_tag(:status, options_for_select([['0', 0], ['1', 1]], selected: @lead.status )) %>     photo of car repair process:     <%= f.file_field :status_photo   %><br/>    <%= f.submit "save changes" %>   <% end %> 

in controller have:

        def update         @lead = lead.find(params[:id])          if @lead.update_attributes(status: params[:status], status_photo: params[:status_photo] )           flash[:success] = "information updated"           redirect_to leads_url         else           render 'edit'         end       end 

as can see update status field updated fine status_photo doesn't. do?


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -