Replace file_columns on Ruby On Rails to Carrierwave
Let's use CarrierWave
Add to Gemfile
gem 'carrierwave'
gem 'mini_magick'
Run this
$> bundle install
In your model add
class SellerProduct < ActiveRecord::Base
mount_uploader :image, ImageUploader
Then launch your server
$> rails server
Replace in the View
Assuming @myProduct is defined
<%= file_column_field("myProduct", "photo") %>
By
<%= form.file_field :photo %>
And replace
<%= image_tag url_for_file_column("temp", "photo", "thumb"), :border=>"0" %>
with
<%= image_tag @temp.photo.thumb %>
In the controller
Use params[:photo]
Recent Comments