Sha256: 7ec05fa70098df7e012c7d9c5d6d1991a2ed2911eb97f6662c193698a653bac1
Contents?: true
Size: 493 Bytes
Versions: 8
Compression:
Stored size: 493 Bytes
Contents
class Photo < MLS::Model belongs_to :subject, :polymorphic => true, :inverse_of => :photos def url(options={}) options.reverse_merge!({ :style => nil, :protocol => "http", :bg => nil, :format => "jpg" }); url_params = {s: options[:style], bg: options[:bg]}.select{ |k, v| v } result = "#{options[:protocol]}://#{MLS.image_host}/#{digest}.#{options[:format]}" result += "?#{url_params.to_param}" if url_params.size > 0 result end end
Version data entries
8 entries across 8 versions & 1 rubygems