Sha256: 798d7405571556776574d8bc8d8677ac6449bd19fea6ffb434b262e940813423

Contents?: true

Size: 761 Bytes

Versions: 24

Compression:

Stored size: 761 Bytes

Contents

if Object.const_defined?("Mongoid")
  class Post
    include Mongoid::Document
    include Mongoid::Timestamps
    include PublicActivity::Model
    
    # Columns
    field :title, :type => String
    field :content, :type => String
    field :is_visible, :type => Boolean

    belongs_to :structure, :index => true
    
    delegate :title, :parent_id, :slug, :to => :structure, :prefix => true

    tracked owner: ->(controller, model) { controller.try(:current_user) }
    
    def self.sunrise_search(params)
      query = scoped
      
      query = query.where(:title => params[:title]) unless params[:title].blank?
      query = query.where(:structure_id => params[:structure_id]) unless params[:structure_id].blank?
      
      query
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
sunrise-cms-1.0.6 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-1.0.5 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-1.0.4 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-1.0.3 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-1.0.2 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-1.0.1 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-1.0.0 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-1.0.0.rc3 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-1.0.0.rc2 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-1.0.0.rc1 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-0.7.0.rc2 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-0.7.0.rc1 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-0.6.11 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-0.6.10 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-0.6.9 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-0.6.8 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-0.6.7 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-0.6.6 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-0.6.5 spec/dummy/app/models/mongoid/post.rb
sunrise-cms-0.6.4 spec/dummy/app/models/mongoid/post.rb