Class: Photo
- Inherits:
-
MLS::Model
- Object
- ActiveRecord::Base
- MLS::Model
- Photo
- Defined in:
- lib/mls/photo.rb
Instance Method Summary collapse
Instance Method Details
#url(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/mls/photo.rb', line 5 def url(={}) .reverse_merge!({ :style => nil, :protocol => "http", :bg => nil, :format => "jpg" }); url_params = {s: [:style], bg: [:bg]}.select{ |k, v| v } result = "#{[:protocol]}://#{MLS.image_host}/#{digest}.#{[:format]}" result += "?#{url_params.to_param}" if url_params.size > 0 result end |