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
| Upgrade System: | |
| sudo apt-get update | |
| sudo apt-get dist-upgrade | |
| Standard Packages: | |
| sudo apt-get install build-essential | |
| Eye Candy: |
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
| Factory.define :application do |factory| | |
| factory.attachment(:sample, "public/samples/sample.doc", "application/msword") | |
| 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
| # Tom's standard rails template | |
| # Application Gems | |
| gem "formtastic", :version => '>= 0.9.7' | |
| gem 'will_paginate', :version => '~> 2.3.11' | |
| gem "acts-as-taggable-on", :version => '>= 1.1.6' | |
| gem "paperclip", :version => '>= 2.3.1.1' | |
| gem "friendly_id", :version => '>= 2.3.2' | |
| gem "inherited_resources", :version => '>= 1.1.0' | |
| gem "thinking-sphinx", :lib => 'thinking_sphinx', :version => '>= 1.3.6' |
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
| # adapted from: http://github.com/railsmachine/shadow_puppet/blob/master/lib/shadow_puppet/core_ext.rb | |
| require 'active_support/core_ext/class/attribute_accessors' | |
| require 'active_support/core_ext/array' | |
| require 'active_support/inflector' | |
| require 'active_support/core_ext/class/inheritable_attributes' | |
| require 'active_support/core_ext/duplicable' | |
| class Hash #:nodoc: | |
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
| def update | |
| @page = Page.find(params[:id[) | |
| enforce_update_permission(@page) do | |
| flash[:error] = "You can only edit your own pages" | |
| redirect_to page_path(@page) | |
| return | |
| end | |
| update! | |
| 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 Tom | |
| attr_accessor :handle | |
| def initialize | |
| @handle = "tomcocca" | |
| end | |
| 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
| page << <<-JS | |
| var manager = $('office_manager_attr').value; | |
| var office_admin = $('office_office_admin_attr').value; | |
| var managers_arr = Array(); | |
| var office_admins_arr = Array(); | |
| managers_arr.push(new Option('', '')); | |
| office_admins_arr.push(new Option('', '')); | |
| JS | |
| @agents.each do |agent| | |
| page << <<-JS |
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 Post < ActiveRecord::Base | |
| has_many :authors | |
| attr_accessor :post_authors_cache | |
| def post_authors | |
| process_post_authors if post_authors_cache.nil? | |
| post_authors_cache | |
| 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 Post < ActiveRecord::Base | |
| has_many :authors | |
| has_many :post_comments | |
| attr_accessor :post_authors_cache, :post_comments_cache | |
| def post_authors | |
| @post_authors_cache ||= begin | |
| process_post |
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 Recipe < ActiveRecord::Base | |
| belongs_to :style, :counter_cache => true | |
| attribute_method_suffix '_previous_change' | |
| private | |
| def attribute_previous_change(attr) | |
| self.changes[attr] |
OlderNewer