This file contains 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 'facets' | |
module Creme | |
def cost | |
puts "before_filter" | |
super | |
end | |
end |
This file contains 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 'mixology' | |
module Callback | |
def filter_with filter, filtered_method | |
Callback.method_factory(filter, filtered_method) | |
end | |
def before_filter filter | |
methods = self.class.instance_methods(false) |
This file contains 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 'mixology' | |
module Callback | |
def before_filter filter, filtered_method | |
Callback.method_factory(filter, filtered_method) | |
end | |
# Needed defin_method here so it's called in module's context | |
def self.method_factory(filter, filtered_method) |
This file contains 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 'mixology' | |
module Callback | |
def cost | |
spoon_required | |
super | |
end | |
end |
This file contains 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 'mixology' | |
module Callback | |
def before_filter filter, filtered_method | |
Callback.method_factory(filter, filtered_method) | |
end | |
# Needed defin_method here so it's called in module's context | |
def self.method_factory(filter, filtered_method) |
This file contains 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 'mixology' | |
module Creme | |
def cost | |
super + 0.4 | |
end | |
end | |
class Coffee |
This file contains 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 Creme | |
def cost | |
super + 0.4 | |
end | |
end | |
class Coffee | |
def cost | |
3 | |
end |
This file contains 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
#route.rb | |
map.resources "orders", order_hash do |order| | |
order.resource "invoice" | |
order.resource "payment", :new => {"express" => :get} | |
end | |
#map.resoures "payments" # not in use anymore ! | |
#payments_controller.rb | |
before_filter :require_order | |
def show |
This file contains 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 PaymentsController < ApplicationController | |
before_filter :find_payment | |
layout "secure" | |
def show(); end | |
private | |
def find_payment | |
@payment = current_order.payment | |
end |
This file contains 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 RAAWS | |
ONE_NECESSARY_SEARCH_PARAM =%w< | |
Actor Artist AudienceRating Author | |
Brand BrowseNode Composer Conductor CityDirector | |
Keywords Manufacturer MusicLabel Neighborhood | |
Orchestra Power Publisher TextStream Title> | |
class ItemOperation < Operation | |
def self.lookup(item_id, index=nil, &block) | |
new.tap do |obj| |