Commit 3fefb305 by thanhnd

mailcatcher and devise

parent 2155b5f7
Pipeline #611 failed with stages
in 0 seconds
...@@ -10,7 +10,7 @@ class JobsController < ApplicationController ...@@ -10,7 +10,7 @@ class JobsController < ApplicationController
end end
def search def search
return redirect_to root_path, alert: "Empty field!" if params[:search].blank? return redirect_to "/jobs", alert: "Empty field!" if params[:search].blank?
solr_rs = Solr.new solr_rs = Solr.new
@pagin_job = solr_rs.query(params[:search], params[:page]) @pagin_job = solr_rs.query(params[:search], params[:page])
end end
......
...@@ -4,7 +4,14 @@ Rails.application.configure do ...@@ -4,7 +4,14 @@ Rails.application.configure do
# In the development environment your application's code is reloaded on # In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development # every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes. # since you don't have to restart the web server when you make code changes.
config.cache_classes = false #config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.default_url_options = { host: 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
#config.action_mailer.smtp_settings = {:address => "localhost", :port => 1025}
#config.cache_classes = false
# Do not eager load code on boot. # Do not eager load code on boot.
config.eager_load = false config.eager_load = false
......
require 'rsolr' require 'rsolr'
class Solr class Solr
attr_accessor :response, :solr attr_accessor :response, :solr
def initialize def initialize
# Direct connection # Direct connection
@solr = RSolr.connect :url => 'http://localhost:8983/solr/jobs/' @solr = RSolr.connect :url => 'http://localhost:8983/solr/jobs/'
@response = nil @response = nil
end end
# send a request to /select # send a request to /select
def query (cond,page) def query (cond,page)
str = RSolr.solr_escape(cond) str = RSolr.solr_escape(cond)
response = solr.paginate page, 10, 'select', :params => {:q => "job_name:#{str}"} response = solr.paginate page, 10, 'select', :params => {:q => "job_name:#{str}"}
response['response']['docs'] response['response']['docs']
end end
end end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment