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 PseudoAR | |
| def self.find(args) | |
| new.tap do |ar| | |
| # do some crazy SQL | |
| end | |
| end | |
| def self.create(args) | |
| new.tap do |ar| | |
| # do some crazy validation |
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
| module OrdersHelper | |
| # helper to determine the active order step given : | |
| # 1. a params[:step] | |
| # 2. if none, according to the order's state | |
| def active_step | |
| @active_step ||= if params[:step] | |
| params[:step] | |
| elsif %(opened).include? @order.state | |
| "1start" |
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
| module TabsHelper | |
| # takes the block | |
| def tabs_for(current_tab, &block) | |
| yield Tab.new(current_tab, self) | |
| end | |
| class Tab | |
| def initialize(current_tab, template) | |
| @current_tab = current_tab |
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
| # In my Image Bank Rails App | |
| class Payment < ActiveRecord::Base | |
| default_scope :conditions => { :application => 'ImageBank' } | |
| before_save { |p| p.application="ImageBank" } | |
| end | |
| # In my Live Performances Rails App | |
| class Payment < ActiveRecord::Base | |
| default_scope :conditions => { :application => 'LivePerformances' } | |
| before_save { |p| p.application="LivePerformances" } |
NewerOlder