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 ApplicationHelper | |
| def breadcrumbs | |
| result = "".html_safe | |
| association_chain.each_with_index do |item, index| | |
| # note that .name works for both classes and objects | |
| result << link_to(item.name.humanize.titlecase, association_chain[0..index]) | |
| result << " » ".html_safe | |
| 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
| def get_bread_crumb(url) | |
| begin | |
| breadcrumb = '' | |
| so_far = '/' | |
| elements = url.split('/') | |
| for i in 1...elements.size | |
| so_far += elements[i] + '/' | |
| if elements[i] =~ /^[0-9]*$/ |
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 GetEventResult | |
| @queue = :events | |
| def self.perform(event_id, attempt=0) | |
| event = Event.find(event_id) | |
| Rails.logger.info "Fetching results for event ##{event.id} (#{event.name})..." | |
| begin | |
| results = EventImporter.new(event.datetime.to_date).get_results(event) | |
| rescue OpenURI::HTTPError |
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
| ==Summary | |
| These instructions detail the configuration of an MS SQL database connection | |
| (and the associated software required) for Ruby on Rails or ActiveRecord. They | |
| rely heavily on input from a variety of blogs (noted with asterisks). | |
| I tested these during the setup of a dev workstation on a Mac Pro with OS X | |
| and a Preview server running CentOS and Plesk 8.6.0. | |
| It seems that ADO doesn't work (or is a nightmare to get working) on a Linux |
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
| CURRENT_RUBY = 'ree-1.8.7-2010.02' | |
| RUBY_PATH = "/home/rails/.rvm/rubies/#{CURRENT_RUBY}" | |
| GEM_HOME = "/home/rails/.rvm/gems/#{CURRENT_RUBY}" | |
| ssh_options[:paranoid] = false | |
| ssh_options[:forward_agent] = true | |
| default_run_options[:pty] = true | |
| set :stages, %w(staging production) |
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
| # | |
| # = Capistrano database.yml task | |
| # | |
| # Provides a couple of tasks for creating the database.yml | |
| # configuration file dynamically when deploy:setup is run. | |
| # | |
| # Category:: Capistrano | |
| # Package:: Database | |
| # Author:: Simone Carletti <[email protected]> | |
| # Copyright:: 2007-2010 The Authors |
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
| # Guide | |
| # Configure the essential configurations below and do the following: | |
| # | |
| # Repository Creation: | |
| # cap deploy:repository:create | |
| # git add . | |
| # git commit -am "initial commit" | |
| # git push origin master | |
| # | |
| # Initial Deployment: |
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
| CURRENT_RUBY = 'ree-1.8.7-2010.02' | |
| RUBY_PATH = "/home/rails/.rvm/rubies/#{CURRENT_RUBY}" | |
| GEM_HOME = "/home/rails/.rvm/gems/#{CURRENT_RUBY}" | |
| ssh_options[:paranoid] = false | |
| ssh_options[:forward_agent] = true | |
| default_run_options[:pty] = true | |
| set :stages, %w(staging production) |
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
| # Redis | |
| %w{6379}.each do |port| | |
| God.watch do |w| | |
| w.name = "redis" | |
| w.interval = 30.seconds | |
| w.start = "/etc/init.d/redis start" | |
| w.stop = "/etc/init.d/redis stop" | |
| w.restart = "/etc/init.d/redis restart" | |
| w.start_grace = 10.seconds | |
| w.restart_grace = 10.seconds |
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
| #Tasks have been added to fully maintain nginx, unicorn, redis, memcached, start resque workers and run any command on any server in the farm. | |
| #<pre> | |
| #cap nginx:restart # Restart Nginx. | |
| #cap nginx:start # Start Nginx. | |
| #cap nginx:status # Status of Nginx. | |
| #cap nginx:stop # Stop Nginx. | |
| #cap nginx:tail_error # Tail the Nginx error logs. | |
| #cap unicorn:reload # reload your unicorn servers. | |
| #cap unicorn:restart # restart your unicorn servers. | |
| #cap unicorn:start # start your unicorn servers. |