evalentini / actprep

ACT test prep app
1 stars 0 forks source link

script that extracts text from image name #6

Closed MattCowski closed 11 years ago

MattCowski commented 11 years ago

dynamically change text fields.

for example "7" if science_page_7.jpg.

MattCowski commented 11 years ago

def default_name self.name ||= File.basename(image.filename, '.*').titleize if image end

This code was in railscast. It takes file name i.e. "image_of_foo.jpg" and converts to "Image of Foo".