Ruby on Rails Carrierwave Uploader

Completed Posted 7 years ago Paid on delivery
Completed Paid on delivery

I am looking to set a default field for a file upload form using the Carrierwave Gem. I already use the following code to set the default title to the filename:

before_create :default_filename

def default_filename

[url removed, login to view] ||= [url removed, login to view]([url removed, login to view], ".*").titleize if file

end

What I would like to do is have another before_create that sets the file "Type"

IF the file extension is .png, .jpg, .jpeg, .gif -> set the "type" field to "image"

IF the file extension is .pdf, .doc -> set the "type" field to "file"

Ruby on Rails

Project ID: #11472356

About the project

3 proposals Remote project Active 7 years ago

Awarded to:

arvindkushwah9

Dear, When I read this job I feel very excited to be a part of your project and share my great experience in software development. I have experience to manage Ruby on Rails developers team. I know thorough how More

$30 USD in 1 day
(6 Reviews)
3.3

3 freelancers are bidding on average $27 for this job

jackreacher262

Hi there, I’d like to be considered for your writing position. I’m a strategic Developer with a strong background developing Websites, including CMS, blog posts, social media posts, articles, press releases and ot More

$25 USD in 1 day
(15 Reviews)
4.4
subhangiroy00

Hello, I have 8 years experience i am Web Developer . I am working as a full time freelance. As a freelance web Developer, I developed websites for many companies and individuals from small to large businesses. MY P More

$25 USD in 1 day
(0 Reviews)
0.0