Class: ActsAsSolr::Post
- Inherits:
-
Object
- Object
- ActsAsSolr::Post
- Defined in:
- lib/acts_as_solr.rb,
lib/acts_as_solr/deprecation.rb
Class Method Summary collapse
Instance Method Summary collapse
- #execute_post ⇒ Object
-
#initialize(body, mode = :search) ⇒ Post
constructor
A new instance of Post.
Constructor Details
#initialize(body, mode = :search) ⇒ Post
Returns a new instance of Post.
4 5 6 7 8 9 |
# File 'lib/acts_as_solr/deprecation.rb', line 4 def initialize(body, mode = :search) @body = body @mode = mode puts "The method ActsAsSolr::Post.new(body, mode).execute_post is depracated. " + "Use ActsAsSolr::Post.execute(body, mode) instead!" end |
Class Method Details
.execute(request, core = nil) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/acts_as_solr.rb', line 26 def self.execute(request, core = nil) config_file_path = File.join(Rails.root, '/config/solr.yml') config = YAML::load_file(config_file_path)[Rails.env] url = config['url'] + (core.nil? ? '' : "/#{core}") connection = Solr::Connection.new(url, :username => config['username'], :password => config['password']) connection.send request end |
Instance Method Details
#execute_post ⇒ Object
11 12 13 |
# File 'lib/acts_as_solr/deprecation.rb', line 11 def execute_post ActsAsSolr::Post.execute(@body, @mode) end |