Skip to content

Instantly share code, notes, and snippets.

@placed_calls = current_user.call_logs.find(:all, :conditions => ['client_id = ?', current_user.id])
@placed_calls_count = Hash.new(0)
@placed_calls.collect { |e| e.vendor }.flatten
@placed_calls.each { |e| @placed_calls_count[e.vendor] += 1}
@placed_calls_count.sort {|a, b| a <=> b}
@placed_calls = current_user.call_logs.find(:all, :conditions => ['client_id = ?', current_user.id])
@placed_calls_vendor_count = Hash.new(0)
@placed_calls.each { |e| @placed_calls_vendor_count[e.vendor] += 1}
@placed_calls_vendor_count.sort {|a, b| a <=> b}
<div id="xrounded">
<b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b>
<div class="xboxcontent">
Content
</div>
- rounded_box do
%p
%span.hentry.yui-gf{"class"=>"#{user.vendor ? 'community_pro' : ''} #{user.featured_writer ? 'featured_writer' : ''}"}
.vcard.author
.yui-u.first.centered
= link_to image_tag( user.avatar_photo_url(:thumb), :class => "polaroid" ), user_path(user)
.yui-g
.yui-u.first
%h2= link_to user.login, user_path(user)
%script
:plain
document.observe('dom:loaded', function() {
$$('a[rel]').each(function(element) {
new Tip(element, { ajax: {url: element.rel, options: {method: 'get'}} });
});
});
%script
:plain
document.observe('dom:loaded', function() {
$$('.user').each(function(element) {
new Tip(element, { ajax: {url: element.select('a[rel]').rel, options: {method: 'get'}} });
});
});
def find_call_session
CallSession.find(:first, :conditions => ["client_id = ? OR vendor_id = ?", id, id])
end
Migration:
class CreateOutboundRates < ActiveRecord::Migration
def self.up
create_table :outbound_rates do |t|
t.string :destination
t.integer :prefix
t.integer :rate_in_cents
t.timestamps
end
class ChatController < ApplicationController
def authorize
xml = Builder::XmlMarkup.new(:indent => 2)
xml.instruct!
xml.auth do
xml.userName
xml.gender
xml.level
xml.photo
xml.photoModeImage
class ChatController < ApplicationController
def authorize
generated_xml = String.new
xml = Builder::XmlMarkup.new(:target => generated_xml, :indent => 2)
xml.instruct!
xml.auth do
xml.userName
xml.gender
xml.level
xml.photo