Paperclip not displaying image

I have installed and setup the paperclip gem but it doesnt display the
images that are suppose to be displayed. Below is the model file and the
controller file

Controller file

class HandymenController < ApplicationController
before_action :find_handyman, only: [:show, :edit, :update,
:destroy]

def index
    if params[:profession].blank?
        @handymen = Handyman.all.order("created_at DESC")
    else
        @profession_id = Profession.find_by(name:

params[:profession]).id
@handymen = Handyman.where(:profession_id =>
@profession_id).order(“created_at DESC”)
end
end

def show
end

def new
    @handyman = current_user.handymen.build
    @professions = Profession.all.map{ |p| [p.name, p.id] }
end

def create
    @handyman = current_user.handymen.build(handyman_params)
    @handyman.profession_id = params[:profession_id]

    if @handyman.save
        redirect_to root_path
    else
        render 'new'
    end
end

def edit
    @professions = Profession.all.map{ |p| [p.name, p.id] }
end

def update
    @handyman.profession_id = params[:profession_id]
    if @handyman.update(handyman_params)
        redirect_to handyman_path(@handyman)
    else
        render 'edit'
    end
end

def destroy
    @handyman.destroy
    redirect_to root_path
end

private

def handyman_params
    params.require(:handyman).permit(:name, :location,

:phone_number, :profession_id, :handyman_img)
end

def find_handyman
    @handyman = Handyman.find(params[:id])
end

end

Model File

class Handyman < ActiveRecord::Base
belongs_to :user
belongs_to :profession

has_attached_file :handyman_img, styles: { handyman_index: “250x350>”,
handyman_show: “325x475>” }
validates_attachment_content_type :handyman_img, content_type:
/\Aimage/.*\Z/
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs