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 CategoriesController < ApplicationController | |
before_filter :find_category, :only => [:show] | |
before_filter :ensure_current_post_url, :only => :show | |
def show | |
@products = @category.products.paginate :page => params[:page], :order => Product.pagination_ordering(session[:prefs][:product_sort]) if @category | |
end | |
private |
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
require 'spec_helper' | |
module PriceBandSpecHelper | |
def valid_attributes | |
{ | |
:start_margin => 10, | |
:end_margin => 30 | |
} | |
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
# Running all features | |
# default runs all webrat features | |
<% | |
def_r = " -r features/support/env.rb -r features/step_definitions features " | |
def_f = " --format pretty " | |
def_t = " --tags ~@wip --tags ~@pending --tags ~@selenium" | |
def_opts = "#{def_r} #{def_f} #{def_t}" | |
use_webrat = "-r features/support/webrat.rb" | |
use_selenium_rc = "-r features/support/selenium_rc.rb" |
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
{ | |
"headline" => "Test story", | |
"url" => "http://news.bbc.co.uk/sport/football", | |
"intro" => "This is the introduction", | |
"lastUpdated" => "10:57 GMT, 08/10/10", | |
"imageUrl" => "http://news.bbcimg.co.uk/media/images/48353000/jpg/_48353797_fabregas_getty226x170.jpg", | |
"imageAlt" => "This is an alt" | |
} |
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 foo | |
# do whatever you need to do | |
end | |
def bar | |
# do whatever you need to do | |
end | |
def foobar | |
foo | |
bar | |
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
[andy@mini-un ~/Sites] (master) | |
➥ rvm use --create 1.9.2@test_rspec | |
Using /Users/andy/.rvm/gems/ruby-1.9.2-p180 with gemset test_rspec | |
[andy@mini-un ~/Sites] (master) ❷@test_rspec | |
➥ gem install rspec | |
Fetching: rspec-core-2.6.3.gem (100%) | |
Fetching: diff-lcs-1.1.2.gem (100%) | |
Fetching: rspec-expectations-2.6.0.gem (100%) | |
Fetching: rspec-mocks-2.6.0.gem (100%) | |
Fetching: rspec-2.6.0.gem (100%) |
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
# Running all features | |
# default runs all webrat features | |
<% | |
def_r = " -r features/support/env.rb -r features/step_definitions features " | |
def_f = " --format pretty " | |
def_t = " --tags ~@wip --tags ~@pending --tags ~@selenium" | |
def_opts = "#{def_r} #{def_f} #{def_t}" | |
use_webrat = "-r features/support/webrat.rb" | |
use_selenium_rc = "-r features/support/selenium_rc.rb" |
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
source 'http://rubygems.org' | |
gem 'rails', '3.1.0.rc4' | |
# Bundle edge Rails instead: | |
# gem 'rails', :git => 'git://github.com/rails/rails.git' | |
gem 'mysql2' | |
# Asset template engines |
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
" Vim functions to run RSpec and Cucumber on the current file and optionally on | |
" the spec/scenario under the cursor. | |
function! RailsScriptIfExists(name) | |
" Bundle exec | |
if isdirectory(".bundle") || (exists("b:rails_root") && isdirectory(b:rails_root . "/.bundle")) | |
return "bundle exec " . a:name | |
" System Binary | |
else | |
return a:name |
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
require 'rubygems' | |
require 'mechanize' | |
require 'json' | |
module ApiExtensions | |
@agent = Mechanize.new | |
@api_header = {'Accept' => 'application/json', 'Content-Type' => 'application/json'} | |
@api_uris = { | |
'the list of campuses' => 'http://example.com/servicehosts/campus.svc', |