Commit 3fefb305 by thanhnd

mailcatcher and devise

parent 2155b5f7
Pipeline #611 failed with stages
in 0 seconds
......@@ -10,7 +10,7 @@ class JobsController < ApplicationController
end
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
@pagin_job = solr_rs.query(params[:search], params[:page])
end
......
......@@ -4,7 +4,14 @@ Rails.application.configure do
# In the development environment your application's code is reloaded on
# 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.
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.
config.eager_load = false
......
require 'rsolr'
class Solr
attr_accessor :response, :solr
def initialize
# Direct connection
@solr = RSolr.connect :url => 'http://localhost:8983/solr/jobs/'
@response = nil
end
def initialize
# Direct connection
@solr = RSolr.connect :url => 'http://localhost:8983/solr/jobs/'
@response = nil
end
# send a request to /select
def query (cond,page)
# send a request to /select
def query (cond,page)
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']
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