Skip to content

Instantly share code, notes, and snippets.

NameError in Forem::Forums#index
Showing /home/dev/demo-search/app/views/layouts/application.html.erb where line #23 raised:
undefined local variable or method `search_path' for #<#<Class:0x8a5b79f0>:0x8a5b70f4>
Extracted source (around line #23):
20
21
22
23
24
# uname -a
Linux myapp 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

# pumactl -v
2.6.0

# pumactl -S /home/myapp/tmp/puma.state restart --config /home/myapp/config/puma.rb
Command restart sent success
{
"ItemSearchResponse" => {
"xmlns" => "http://webservices.amazon.com/AWSECommerceService/2011-08-01", "OperationRequest" => {
"HTTPHeaders" => {
"Header" => {
"Name" => "UserAgent", "Value" => "Jeff/1.0.1 (Language=Ruby; dev.my.domain)"
}
}, "RequestId" => "4ba63efd-0ff2-4b71-9713-eced654944fd", "Arguments" => {
"Argument" => [{
"Name" => "Service", "Value" => "AWSECommerceService"
@frankie-loves-jesus
frankie-loves-jesus / openbsd55.md
Last active August 29, 2015 14:01
OpenBSD 5.5 and rvm

http://www.openbsd.org/55.html

dev% curl -L https://get.rvm.io | bash -s stable --ruby
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   184  100   184    0     0     11      0  0:00:16  0:00:15  0:00:01    45
100 20511  100 20511    0     0    713      0  0:00:28  0:00:28 --:--:-- 14323
Downloading https://github.com/wayneeseguin/rvm/archive/stable.tar.gz

Cool pg_search stats

Attempt to display some cool search stats using pg_search. About 759,000,000 results (0.29 seconds), Searches related to <keyword>: <keyword> <keyword> <keyword> etc.

Hi,

Here's a gist which sketches a very basic implementation. There are some shortcomings, but I hope it's clear how to tweak and extend it to fit your purposes. I'm not sure how to get ActiveRecord to return the duration of a single query, which is why I set the @duration to the "realtime" benchmark of the whole time spent in ActiveRecord. You may be able to do something hacky with ActiveSupport::Notifications, but I opted for an easy-to-understand solution over a technically precise solution.

P.S. the Case Commons Development Google Group is quite helpful for all things pg_search, and I'm sure they have more intelligent things to say than I! >

@frankie-loves-jesus
frankie-loves-jesus / 1 - Info.md
Last active August 29, 2015 14:01
Random Ruby cron schedule with Whenever and ruby-thread

Randomized Ruby cron schedule with Whenever

% env
!::=::\
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\anon\AppData\Roaming
COMMONPROGRAMFILES=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=MACBOOK
COMSPEC=C:\Windows\system32\cmd.exe
FP_NO_HOST_CHECK=NO