app/models/slide.rb in beef-slides-1.1.5 vs app/models/slide.rb in beef-slides-1.1.7

- old
+ new

@@ -12,15 +12,22 @@ attr_accessible :slide_show_id, :title, :date, :link, :strapline, :publish, :hide, :uploaded_data, :body default_scope :order => 'position ASC' + before_save :correct_url + def to_json(options = {}) options.reverse_merge! :methods => :public_filename, :only => [:title, :strapline, :link, :date] super options end private def has_file? filename != 'no_file' + end + + + def correct_url + write_attribute :link, self.link.gsub(/^http\:\/\//i,'') unless self.link.nil? end end