Class: Edgarj::Search

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Conversion, ActiveModel::Naming, ActiveModel::Translation
Includes:
ActiveModel::Validations
Defined in:
app/models/edgarj/search.rb

Overview

Search condition

Abstract class to SearchForm and SearchPopup to provide common method ‘conditions’.

‘Search’ instance will be stored in view_status.model.

@errors will be used for error_messages_for helper in search-form.

Direct Known Subclasses

SearchForm, SearchPopup

Defined Under Namespace

Classes: Cache

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Search

Returns a new instance of Search.



45
46
47
48
# File 'app/models/edgarj/search.rb', line 45

def initialize(klass)
  @errors     = ActiveModel::Errors.new(self)
  @_klass_str = klass.to_s
end

Instance Attribute Details

#_klass_strObject

Returns the value of attribute _klass_str.



43
44
45
# File 'app/models/edgarj/search.rb', line 43

def _klass_str
  @_klass_str
end

#errorsObject

Returns the value of attribute errors.



43
44
45
# File 'app/models/edgarj/search.rb', line 43

def errors
  @errors
end

Instance Method Details

#conditionsObject

generate search-conditions from ActiveRecord attributes

RETURN

[condition_string, value_array]

values for :conditions option on model



54
55
56
# File 'app/models/edgarj/search.rb', line 54

def conditions
  raise "Not implemented"
end

#persisted?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'app/models/edgarj/search.rb', line 58

def persisted?
  false
end