diff --git a/app/models/cmtool/image.rb b/app/models/cmtool/image.rb index 135d18f..b0de23f 100644 --- a/app/models/cmtool/image.rb +++ b/app/models/cmtool/image.rb @@ -5,7 +5,7 @@ module Cmtool property :file_file_name property :file_content_type - property :file_file_size, type: Fixnum + property :file_file_size, type: Integer property :file_updated_at, type: Time has_attached_file :file, styles: { page: '728x10000>', medium: "354x1000>", thumb: "160x1250>" }, path: ":rails_root/public/system/:attachment/:id/:style.:extension", diff --git a/app/models/cmtool/news.rb b/app/models/cmtool/news.rb index 647c960..12cd732 100644 --- a/app/models/cmtool/news.rb +++ b/app/models/cmtool/news.rb @@ -2,29 +2,29 @@ module Cmtool class News include SimplyStored::Couch include Paperclip::Glue - + property :title property :active, type: :boolean, default: true property :date, type: Date property :body - + property :image_file_name property :image_content_type - property :image_file_size, type: Fixnum + property :image_file_size, type: Integer property :image_updated_at, type: Time - + has_attached_file :image, styles: { :medium => "500x500>", :thumb => "250x250>" } has_and_belongs_to_many :keywords, storing_keys: true validates :title, presence: true validates :date, presence: true - + view :all_documents, key: :date, descending: true view :by_active, key: [:active, :date], descending: true - + def self.active(options = {till: Date.today}) find_all_by_active(true, options) end - + def self.find_all_by_active(active, options = {till: Date.today}) database.view(by_active(startkey: [active, options[:till].strftime('%Y-%m-%d')], endkey: [active], descending: true)) end diff --git a/app/models/cmtool/quote.rb b/app/models/cmtool/quote.rb index e3f602d..0be0358 100644 --- a/app/models/cmtool/quote.rb +++ b/app/models/cmtool/quote.rb @@ -7,24 +7,24 @@ module Cmtool property :function property :state property :body - property :active, :type => :boolean, :default => true + property :active, type: :boolean, default: true property :locale property :image_file_name property :image_content_type - property :image_file_size, :type => Fixnum - property :image_updated_at, :type => Time + property :image_file_size, type: Integer + property :image_updated_at, type: Time - has_attached_file :image, :styles => {:medium => "300x1000>", :thumb => "137x1250>" } + has_attached_file :image, styles: {medium: "300x1000>", thumb: "137x1250>" } - view :for_sidebar_view, :key => [:state, :created_at], :conditions => %{doc['active']} + view :for_sidebar_view, key: [:state, :created_at], conditions: %{doc['active']} STATES = %w[page sidebar] def self.active(*args) database.view(for_sidebar_view(*args)) end def self.for_page - active(:startkey => ['page'], :endkey => ['page', {}]) + active(startkey: ['page'], endkey: ['page', {}]) end def self.states @@ -32,7 +32,7 @@ module Cmtool end def self.for_sidebar - active(:startkey => ['sidebar'], :endkey => ['sidebar', {}], :limit => 2) + active(startkey: ['sidebar'], endkey: ['sidebar', {}], limit: 2) end end end