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
| # With classy style sinatra you'll want to set raise_errors so the error block | |
| # executes, hoptoad knows and the user gets a 500 page | |
| configure do | |
| set :raise_errors, false | |
| 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
| # before filter | |
| before do | |
| p = request.env['PATH_INFO'] | |
| @request_url = p[1..p.length] unless p.nil? | |
| end | |
| # app_helper | |
| def callback_attribute | |
| if defined?(@request_url) && !@request_url.nil? | |
| "callbackurl='#{link_to_app(@request_url)}?_method=GET'" |
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
| if env["REQUEST_METHOD"] == "POST" | |
| req = Request.new(env) | |
| method = req.params[METHOD_OVERRIDE_PARAM_KEY] || env[HTTP_METHOD_OVERRIDE_HEADER] | |
| method = method.to_s.upcase | |
| if HTTP_METHODS.include?(method) | |
| env["rack.methodoverride.original_method"] = env["REQUEST_METHOD"] | |
| env["REQUEST_METHOD"] = method | |
| 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
| alias :url_for :link_to_app | |
| def url_for_img(filename) | |
| url_for "/img/#{filename}", :skip_facebook => true | |
| 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
| ENV['SAILS_ENV'] = 'mj_dev' | |
| require 'spec' | |
| require File.expand_path(File.dirname(__FILE__)) + '/../../config/boot.rb' | |
| describe 'Rivalry' do | |
| it "should instantiate a rivalry from two rivals" do | |
| puts "run test" | |
| rivals = [ |
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
| rake rack_hoptoad:spec --trace | |
| (in /home/deploy/junk/rack_hoptoad) | |
| ** Invoke rack_hoptoad:spec (first_time) | |
| ** Invoke rack_hoptoad:clobber_spec (first_time) | |
| ** Execute rack_hoptoad:clobber_spec | |
| rm -r coverage | |
| ** Execute rack_hoptoad:spec | |
| Rack::HoptoadNotifier | |
| - yields a configuration object to the block when created (PENDING: TODO) |
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
| NOTE: Put in ~/.irbrc | |
| --- | |
| :update_sources: true | |
| :bulk_threshold: 1000 | |
| :sources: | |
| - http://gems.rubyforge.org/ | |
| - http://gems.github.com | |
| - http://gems.github.com | |
| gem: --no-ri --no-rdoc |
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
| macbook$ ./script/console | |
| Loading development environment (Rails 2.1.1) | |
| >> a = Album.find(:first) | |
| => #<Album id: 1, artist_id: 1, producer_id: 1, title: "LIGHT YOUR FIRE ", audioformat_id: 3> | |
| >> |