Skip to content

Instantly share code, notes, and snippets.

View ratnikov's full-sized avatar

Dmitry Ratnikov ratnikov

  • wonder.com
  • New York, NY
View GitHub Profile
def new_list_item_link
content_for :action_links do
link_to "New #{controller.controller_name.humanize.titleize.singularize}", eval("new_managed_lists_#{controller.controller_name.singularize}_path")
end
end
describe "#new_list_item_link" do
before do
helper.should_receive(:new_managed_lists_test_path).and_return 'test_path_url'
helper.new_list_item_link
<?xml ...?>
<% @posts.each do |post| -%>
<post>
<title><%= post.title %></title>
<content>
<%= render :partial => '...' %>
</content>
</post>
def client_threshold_reached?
self.plan.num_of_clients == self.clients.count
end
@available_fetchers = Fetcherr.all
if @available_fetchers.empty?
puts "No fetchers found"
else
@available_fetchers.each do |fetcher|
puts "Loading the #{fetcher.name} fetcher"
klass = Class.new do
include HTTParty
module Invite
module Inviter
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
attr_reader :invite_block
= form_for ([@ticket.ticketable, @ticket]) do |f|
= debug @ticket
= debug ticket.ticketable
= f.error_messages
%p
= f.label :title, "Brief Title for Issue"
= f.text_field :title
%p
= f.label :call_type
%br/
=> Booting WEBrick
=> Rails 3.0.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-01-18 20:53:12] INFO WEBrick 1.3.1
[2011-01-18 20:53:12] INFO ruby 1.9.2 (2010-12-25) [x86_64-darwin10.5.0]
[2011-01-18 20:53:12] INFO WEBrick::HTTPServer#start: pid=3154 port=3000
Started POST "/tickets" for 127.0.0.1 at 2011-01-18 20:53:44 -0500
Started GET "/companies/3/tickets/new" for 127.0.0.1 at 2011-01-18 20:34:21 -0500
Processing by TicketsController#new as HTML
Parameters: {"company_id"=>"3"}
SQL (0.4ms) SHOW TABLES
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 1) LIMIT 1
CACHE (0.0ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 1) LIMIT 1
Completed in 98ms
ActiveRecord::RecordNotFound (Couldn't find Company without an ID):
app/controllers/tickets_controller.rb:54:in `find_company'
class CompaniesController < ApplicationController
# GET /companies
# GET /companies.xml
def index
@companies = Company.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @companies }
end