Class: RailsFilemanager::User_file

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/rails_filemanager/user_file.rb

Instance Method Summary collapse

Instance Method Details

#allow_only_imagesObject



9
10
11
# File 'app/models/rails_filemanager/user_file.rb', line 9

def allow_only_images
  false unless self.image?
end

#image?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'app/models/rails_filemanager/user_file.rb', line 13

def image?
  self.file_file_name =~ /(\.jpg|\.jpeg|\.png|\.gif)$/i
end

#thumb_urlObject



17
18
19
20
21
22
23
# File 'app/models/rails_filemanager/user_file.rb', line 17

def thumb_url
  if self.image?
    self.file.url(:thumb)
  else
    "/assets/rails_filemanager/file.png"
  end
end