This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ApplicationController | |
| after_filter :record_create, :only => [ :create ] | |
| after_filter :record_update, :only => [ :update ] | |
| after_filter :record_destroy, :only => [ :destroy ] | |
| private | |
| def record_create | |
| Event.create! :record => record, :controller => name, :action => :create unless record.previous_changes.empty? | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class A | |
| def initialize | |
| @foo = "bar" | |
| end | |
| end | |
| class B < A | |
| def initialize | |
| super # invoke the super initialize | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Link | |
| attr_reader :url | |
| def initialize(url) | |
| @url = url | |
| end | |
| def bad? | |
| return false if link.blank? | |
| (GlobalPreference.get('suspicious_words') + GlobalPreference.get('bad_words')).any? { |word| url =~ eval("/#{word.strip}/") } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Invite | |
| module Inviter | |
| def self.included(base) | |
| base.extend(ClassMethods) | |
| end | |
| module ClassMethods | |
| attr_reader :invite_block |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| = 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/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| => 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Admin::AuditsController < ApplicationController | |
| def create | |
| @audit = Audit.new params[:audit] | |
| if @audit.valid? | |
| # ... | |
| else | |
| render :action => 'new' | |
| end | |
| end |