samedi 16 avril 2016

can't upload file ruby on rails

i'm working with ruby on rails, and i want to upload a file using gem 'carrierwave', i don't have error buh i dont see it in database it's empty all times, that's what i'm doing :

new.html.erb

<div class="field">
 <%= f.label :cv, "Charger votre CV au format pdf" %><br />
 <%= f.file_field :cv %>

show.html.erb:

  <strong> cv :</strong> <%= link_to "cv", @user.cv.url %>

controller:

def create
@user = User.new(params[:user])
 if @user.save
  flash[:success] = "Bienvenue dans mon application ruby on Rails!"
  redirect_to @user
else
  @titre = "Inscription"
  render 'new'
end

model:

attr_accessible :nom,  :cv
    mount_uploader :cv, CvUploader

i had add a db migrate but nothing change

"sorry for my bad english"

Aucun commentaire:

Enregistrer un commentaire