Skip to content

Instantly share code, notes, and snippets.

View dougjohnston's full-sized avatar

Doug Johnston dougjohnston

View GitHub Profile
config.before(:suite) do
raise 'Don\'t use transactional fixtures!' if config.use_transactional_fixtures?
puts 'Making sure the portal schema is loaded and accessible'
Rails.application.load_tasks
Rake::Task['db:test:load_portal'].invoke
DatabaseCleaner.clean_with(:truncation)
end
@dougjohnston
dougjohnston / binarytree.rb
Last active August 29, 2015 14:06 — forked from yuya-takeyama/binarytree.rb
Binary tree implemented in Ruby.
module BinaryTree
class Node
attr_reader :word, :count
attr_accessor :left, :right
include Enumerable
def initialize(word)
@word = word
@count = 1
@dougjohnston
dougjohnston / gist:6454744
Created September 5, 2013 19:12
RVM help not displaying Unicode characters
Some of the the RVM help documentation includes Unicode characters. When running 'rvm help <command>', the Unicode characters are not displayed properly.
Example:
$ rvm help use
�M-^H� rvm use [ruby-string]
Setup current shell to use a specific ruby version.
vendor/rails/activesupport/lib/active_support/core_ext/array/conversions.rb:151:in `to_xml'
vendor/rails/activesupport/lib/active_support/core_ext/hash/conversions.rb:129:in `to_xml'
vendor/rails/activesupport/lib/active_support/core_ext/hash/conversions.rb:124:in `each'
vendor/rails/activesupport/lib/active_support/core_ext/hash/conversions.rb:124:in `to_xml'
/Library/Ruby/Gems/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:134:in `call'
/Library/Ruby/Gems/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:134:in `_nested_structures'
/Library/Ruby/Gems/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:58:in `method_missing'
vendor/rails/activesupport/lib/active_support/core_ext/hash/conversions.rb:123:in `__send__'
vendor/rails/activesupport/lib/active_support/core_ext/hash/conversions.rb:123:in `to_xml'
vendor/rails/activeresource/lib/active_resource/base.rb:858:in `to_xml'
def update
ticket = Lighthouse::Ticket.find(params[:id], :params => { :project_id => params[:project_id] })
ticket.body = params[:comment]
ticket.state = params[:state]
ticket.save
end
attr_accessor :ownership
validates_acceptance_of :ownership,
:on => :create,
:allow_nil => true,
:accept => true,
:message => 'You must indicate that you own the copyrights to the photo you are uploading.'