Posts

Showing posts from September, 2016

Uploading profile pic using photofy gem

Hi fellas, Photofy gem is to provide simple method to do fileupload of pictures and provides getter setter methods of it and save on model object commit we are used of using paperclip and other gems. But it saves your effort from active record and other kind of stuffs. Include gem photofy in your Gem file. gem 'photofy' bundle install define photofy with the config in the model for which you want the file upload photofy(:avatar_image, {image_processor: Proc.new {|img| img.scale(200,200)}}) here after that you need to define your file upload attribute as: <%= f.file_field :avatar_image %> in the form where you want to upload the file after that in your action please whitelist your avatar_image attribute as: params.require(:users).permit(:name, :avatar_image)  Please be assure you have rmagick gem and imagemagick installed in your system. After uploading pic and submitting the form you will see a photofy folder will be created in app directory but