Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
startme() {
cd ~/vas/vas
/home/abejide/.rvm/gems/ruby-1.9.2-p180/bin/rackup faye.ru -s thin -E production &
/home/abejide/.rvm/gems/ruby-1.9.2-p180/bin/rails s
}
stopme() {
ajaxsearch_controller.rb
class AjaxsearchController < ApplicationController
def new
begin
@search = Sugar.find(:all, :conditions => {:first_name => "LIKE '%#{params[:name]}%'"}).collect{ |user| "<tr><td><b><a href='http://10.10.5.104:8080/wakanow/index.php?module=Contacts&action=DetailView&record="+"#{user.id}" + "'>" + "#{user.account_name}"+"</b></td>" + "</a><td>Email address: <b>" + "#{user.email1}"+"</b><a href=" + 'http://10.10.5.104:8080/wakanow/index.php?module=Contacts&action=DetailView&record=' + "#{user.id}" + "><img border=0 src='jquery/images/contacts.gif' title=" + "#{user.account_name}" + "/></a></tr>" }
# @search = Sugar.find(:all, :conditions => {:first_name => "LIKE '%#{params[:name]}'"}).collect{ |user| { :first_name => user.first_name :id => user.account_id, :name => user.account_name }}
rescue
@search = Sugar.find(:all, :conditions => {:first_name => "LIKE '%#{params[:name]}%'"}).collect{ |user| "<tr><td><b><a href='http://10.10.5.104:8080/wakanow/index.php?
class AjaxsearchController < ApplicationController
require 'stalker'
def new
begin
@search = Sugar.find(:all, :conditions => {:first_name => "LIKE '%#{params[:name]}%'"}).collect{ |user| "<tr><td><b><a href='http://10.10.5.104:8080/wakanow/index.php?module=Contacts&action=DetailView&record="+"#{user.id}" + "'>" + "#{user.account_name}"+"</b></td>" + "</a><td>Email address: <b>" + "#{user.email1}"+"</b><a href=" + 'http://10.10.5.104:8080/wakanow/index.php?module=Contacts&action=DetailView&record=' + "#{user.id}" + "><img border=0 src='jquery/images/contacts.gif' title=" + "#{user.account_name}" + "/></a></tr>" }
# @search = Sugar.find(:all, :conditions => {:first_name => "LIKE '%#{params[:name]}'"}).collect{ |user| { :first_name => user.first_name :id => user.account_id, :name => user.account_name }}
rescue
@search = Sugar.find(:all, :conditions => {:first_name => "LIKE '%#{params[:name]}%'"}).collect{ |user| "<tr><td><b><a href='http://10.10.5.104:8080/wakanow/index.php?module=C
job.rb
require File.expand_path("../environment", __FILE__)
require 'faye'
job "sugar.find" do |args|
begin
=begin
faye = Faye::Client.new('http://10.10.5.96:9292/faye')
msge = JSON.dump('channel' => "/ajaxsearches", 'data' => {'exten_no' => "#{@ajaxsearches.extenno}", 'resarray' => "#{@search}"})
$(function(){
var client = new Faye.Client('http://10.10.5.96:9292/faye');
client.subscribe("/ajaxsearches", function(data) {
var exten = (data.exten_no);
var searcharray = (data.resarray);
var contact = "<a href= 'http://10.10.5.104:8080/wakanow/index.php?module=Contacts&action=EditView&return_module=Contacts&return_action=index' title='Create Contact'>Create Contact</a>"
var contactImage = "<a href= 'http://10.10.5.104:8080/wakanow/index.php?module=Contacts&action=EditView&return_module=Contacts&return_action=index' title='Create Contact'><img title='Create Contact' border=0 src='jquery/images/contact_plus.gif'/></a>"
var service = "<a href= 'http://10.10.5.104:8080/wakanow/index.php?module=Cases&action=EditView&return_module=Cases&return_action=index' title='Service Request'>Service Request</a>"
switchvox.yml
default:
switchvox_ip: PBX.IP.Com
faye_ip: 0.0.0.0:9292
development:
switchvox_ip: PBX.IP.Com
faye_ip: 0.0.0.0:9292
production:
Sugar.count(:conditions => {:phone_work => "LIKE %#{params[:cid_number]}%"})
You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil
sugar.rb
#the class defines the webservices to connect to sugarCRM
class Sugar < SugarCRM::Contact
end
$(function(){
var client = new Faye.Client('http://10.10.5.96:9292/faye');
client.subscribe("/ajaxsearches", function(data) {
exten = (data.exten_no);
searcharray = (data.resarray);
contact = "<a href= 'http://10.10.5.104:8080/wakanow/index.php?module=Contacts&action=EditView&return_module=Contacts&return_action=index' title='Create Contact'>Create Contact</a>"
contactImage = "<a href= 'http://10.10.5.104:8080/wakanow/index.php?module=Contacts&action=EditView&return_module=Contacts&return_action=index' title='Create Contact'><img title='Create Contact' border=0 src='jquery/images/contact_plus.gif'/></a>"
service = "<a href= 'http://10.10.5.104:8080/wakanow/index.php?module=Cases&action=EditView&return_module=Cases&return_action=index' title='Service Request'>Service Request</a>"
/home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rails (>= 0) amongst [minitest-1.6.0, rake-0.8.7, rdoc-2.5.8] (Gem::LoadError)
from /home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1195:in `gem'
from /home/zeep/.rvm/gems/ruby-1.9.2-p290/bin/rails:18:in `<main>'
/home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rack (>= 0) amongst [minitest-1.6.0, rake-0.8.7, rdoc-2.5.8] (Gem::LoadError)
from /home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1195:in `gem'
from /home/zeep/.rvm/gems/ruby-1.9.2-p290/bin/rackup:18:in `<main>'
/usr/bin/env: ruby: No such file or directory
/home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rails (>= 0) amongst [minitest-1.6.0, rake-0.8.7, rdoc-2.5.8] (Gem::LoadError)
from /home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1195:in `gem'
from /home/zeep/.rvm/gems/ruby-1.9.2-p290/bin/rails:18:in `<main>'
/home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rack (>= 0) amongst [minitest-1.6.0, rake-0.8.7, rdoc-2.5.8] (Gem::LoadError)
from /home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/zeep/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1195:in `gem'
from /home/zeep/.rvm/gems/ruby-1.9.2-p290/bin/rackup:18:in `<main>'
/usr/bin/env: ruby: No such file or directory