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
namespace :db do | |
desc "Rolls the schema back to the previous version. Specify the number of steps with STEP=n" | |
task :rollback => :environment do | |
step = ENV['STEP'] ? ENV['STEP'].to_i : 1 | |
version = ActiveRecord::Migrator.current_version - step | |
ActiveRecord::Migrator.migrate('db/migrate/', version) | |
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
tag_method_map = {"string" => :text_field_tag, "text" => :text_area_tag, "integer" => :number_field_tag} | |
tag_method = tag_method_map[options[:type]] | |
input = @template.send(tag_method, options[:name], "", :class => options[:input_class], :required => options[:required] ? "required" : nil) |
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
def active_class(controller, action = nil) | |
active = params[:controller] == controller.to_s && | |
(action.nil? || params[:action] == action.to_s) | |
active ? "active" : nil | |
end | |
def nav_link(link_text, controller) | |
content_tag(:li, :class => active_class(controller, action) do | |
link_to link_text, controller |
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
def active_if(controller, action = nil) | |
active = params[:controller] == controller.to_s && | |
(action.nil? || params[:action] == action.to_s) | |
active ? "active" : nil | |
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
(rdb:1) pp nil ; 43 | |
nil | |
*** Unknown command: " 43". Try "help". |
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 Server | |
def self.all | |
load_all_server_info_from_api.collect { |server_info| Server.new(server_info) } | |
end | |
def name | |
@server_info.name | |
end | |
def alive? |
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
resources :cars, :except => :index do | |
collection do | |
post :index | |
end | |
member do | |
get :registration_details | |
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
$netRevenueTd = $tr.find("td[data-property='net_revenue']") | |
if ddr.properties.net_revenue_estimated | |
$netRevenueTd.addClass("estimated") | |
else | |
$netRevenueTd.removeClass("estimated") |
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
def is_votable? | |
return false unless active | |
running? | |
end | |
def time_boxed? | |
starting_at.nil? && ending_at.nil? | |
end | |
def running? |
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
SELECT `campaigns`.* FROM `campaigns` | |
WHERE | |
( | |
( | |
(media_plan_lines.start_at <= '2012-09-21' | |
AND | |
media_plan_lines.end_at >= '2012-09-21') | |
OR | |
(DATEDIFF(CURDATE(), media_plan_lines.end_at) <= 10) | |
) |