Skip to content

Instantly share code, notes, and snippets.

class Product < ActiveRecord::Base
belongs_to :user
has_many :assets, :dependent => :destroy
has_many :comments, :dependent => :destroy
accepts_nested_attributes_for :assets, :allow_destroy => true
has_attached_file :photo,
:styles => {
:thumb => '50x50#',
:large => '400x400#'
},
<% unless @photos.empty? %>
<% @photos.each do |photo| %>
<% image_tag(photo.image.url) %><br>
<% end %>
<% end %>
2011-06-22T18:49:28+00:00 heroku[nginx]: GET / HTTP/1.1 | 82.128.25.37 | 796 | http | 503
2011-06-22T18:53:10+00:00 heroku[slugc]: Slug compilation started
2011-06-22T18:53:12+00:00 heroku[api]: Deploy eb71c19 by ayodeleabejide@hotmail.com
2011-06-22T18:53:12+00:00 heroku[api]: Release v9 created by ayodeleabejide@hotmail.com
2011-06-22T18:53:12+00:00 heroku[web.1]: State changed from crashed to created
2011-06-22T18:53:12+00:00 heroku[web.1]: State changed from created to starting
2011-06-22T18:53:12+00:00 heroku[slugc]: Slug compilation finished
2011-06-22T18:53:17+00:00 heroku[web.1]: Starting process with command: `thin -p 40678 -e producti
2011-06-22T18:53:18+00:00 app[web.1]: config.ru:1:in `block (3 levels) in <main>': undefined method `e' for #<Rack::Builder:0x00000002441090> (NoMethodError)
3 $(function() {
4 setTimeout(updateComments, 100000);
5 });
6
7 function updateComments () {
8 $.getScript("/show.js");
9 setTimeout(updateComments, 100000);
10 }
~
application.js
1 // Place your application-specific JavaScript functions and classes here
2 // This file is automatically included by javascript_include_tag :defaults
3 $(function() {
4 setTimeout(updateCalls, 500);
5 });
6
7 function updateCalls () {
8 if ('data-user' == 'data-exten') {
index.js.erb
1 if (<%=Switchvox.last.exten_number%> == 4101) {
2 $.modal("#boxes");
3 }
4 //http://www.ericmmartin.com/projects/simplemodal/
index.html.erb
<h1>Listing switchvoxes</h1>
2 <%= render 'call' %>
index.html
<!DOCTYPE html>
<html>
<head>
<title>Vas2</title>
<link href="/stylesheets/a.css?1311090857" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/jquery.ui.all.css?1311187248" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/jquery.ui.base.css?1311187248" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/jquery.ui.core.css?1311187248" media="screen" rel="stylesheet" type="text/css" />
<link href="/stylesheets/jquery.ui.theme.css?1311187248" media="screen" rel="stylesheet" type="text/css" />
3 resources :switchvoxes do
4 post 'hangup', :on => :member
5 end
ruby code
1 require 'switchvox'
2 switchvox = Switchvox::Base.new("IP.com", 'admin', 'password', {:debug => true})
3 dial = switchvox.request("switchvox.call", {
4 "dial_first" => "4600",
5 "dial_second" => "4100",
6 "dial_as_account_id" => "1122",
7 })
8 calls = dial.calls.call
Started GET "/incomings/new?cid_number=4100&exten_number=4600" for 10.10.5.240 at 2011-07-25 13:16:23 +0100
Processing by IncomingsController#new as HTML
Parameters: {"cid_number"=>"4100", "exten_number"=>"4600"}
SQL (0.5ms) BEGIN
SQL (2.8ms) describe `incomings`
AREL (1.7ms) INSERT INTO `incomings` (`cid_number`, `exten_number`, `created_at`, `updated_at`, `exten_id`) VALUES ('4100', '4600', '2011-07-25 12:16:23', '2011-07-25 12:16:23', NULL)
SQL (48.8ms) COMMIT
Rendered incomings/new.html.erb within layouts/application (91.6ms)
Completed 200 OK in 379ms (Views: 127.1ms | ActiveRecord: 53.7ms)