Class: Avatar
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Avatar
- Defined in:
- lib/generators/authkit/templates/app/models/avatar.rb
Instance Method Summary collapse
Instance Method Details
#as_json(options = {}) ⇒ Object
14 15 16 17 18 |
# File 'lib/generators/authkit/templates/app/models/avatar.rb', line 14 def as_json( = {}) super({ methods: [:url] }.merge()) end |
#import! ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/generators/authkit/templates/app/models/avatar.rb', line 24 def import! return false unless self. self. = false if self.remote_url.present? uri = URI.parse(self.remote_url) self. = uri self. = File.basename(URI.decode(uri.path)) end self.save end |
#url ⇒ Object
20 21 22 |
# File 'lib/generators/authkit/templates/app/models/avatar.rb', line 20 def url self..url(:thumb) end |