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 display | |
| result = open(gist_url).read | |
| out = result.scan(/document.write\('(.*|\s*)'\)/)[1] | |
| out.nil? ? "Not Found" : out[0] | |
| 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 Exceptions < Merb::Controller | |
| # handle NotFound exceptions (404) | |
| def not_found | |
| render :format => :html | |
| end | |
| # handle NotAcceptable exceptions (406) | |
| def not_acceptable | |
| render :format => :html |
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 Array | |
| def uniq_by(method) | |
| results = [] | |
| self.map do |e| | |
| result = e.send(method) | |
| results.include?(result) ? nil : (results << result; e) | |
| end.compact | |
| 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
| #Controller | |
| before :ensure_authenticated, :exclude => [:index, :show] | |
| def new(project_id) | |
| only_provides :html | |
| @ticket = Ticket.new(:project_id => project_id) | |
| display @ticket | |
| end | |
| # RSPEC |
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
| # This file is specifically for you to define your strategies | |
| # | |
| # You should declare you strategies directly and/or use | |
| # Merb::Authentication.activate!(:label_of_strategy) | |
| # | |
| # To load and set the order of strategy processing | |
| Merb::Slices::config[:"merb-auth-slice-password"][:no_default_strategies] = true | |
| module Merb::Authentication::Strategies |
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
| New entry posted to the journal: | |
| = self.params[:entry].body |
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
| given "logged in" do | |
| login | |
| end | |
| context "when logged in" do | |
| context "Homepage: url(:home)", :given => "logged in" do | |
| before(:each) do | |
| @rack = request(:home) | |
| 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 ChangeTaxRate < ActiveRecord::Migration | |
| def self.up | |
| execute "ALTER TABLE `tax_rates` CHANGE `rate` `rate` DECIMAL( 8, 6 ) NULL DEFAULT '0.0000'" | |
| end | |
| def self.down | |
| 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
| Throw your "static" views in app/views/static... and it just works, page cached and all. |
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
| Merb.logger.info("Compiling routes...") | |
| Merb::Router.prepare do | |
| # Administration | |
| match('/admin').to(:namespace => "admin") do | |
| resources :locations | |
| resources :users | |
| resources :links | |
| match("/offer").to(:controller => "offer") do | |
| match(:method => "get").to(:action => "show").name(:offer) | |
| match("/edit", :method => "get").to(:action => "edit").name(:edit_offer) |