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 Numeric | |
# Usage: 1234.commify # => '1,234' | |
def commify | |
self.to_s.reverse.scan(/(?:\d*\.)?\d{1,3}-?/).join(',').reverse | |
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
<script type="text/javascript"> | |
function comma(num) { | |
var collector = new Array(); | |
var numberArray = ('' + num).split('').reverse(); | |
for(var i = 0; i < numberArray.length; i++) { | |
if(i % 3 == 0 && i != 0) collector.push(","); | |
collector.push(numberArray[i]); | |
} | |
return collector.reverse().join(''); | |
} |
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
App failed to start | |
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack.rb:17: warning: already initialized constant VERSION | |
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin/loader.rb:184:in `ensure_all_registered_plugins_are_loaded!': Could not locate the following plugins: community_engine and white_list (LoadError) | |
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin/loader.rb:44:in `load_plugins' | |
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:348:in `load_plugins' | |
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:163:in `process' | |
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in `send' | |
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in `run' | |
from /disk1/home/slugs/12838_f2b2289_c549/mnt/config/environment.rb:11 |
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 InquireyResponseHandler < ActionMailer::Base | |
def receive(email) | |
user = User.find_by_email(email.from[0]) | |
Mood.create :message => email.body, :user => user | |
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
>> Project.reflections.each {|a| puts a.class } | |
Array | |
=> {:tasks=>#<ActiveRecord::Reflection::AssociationReflection:0x222cbc4 @klass=Task(id: integer, name: string, project_id: integer, created_at: datetime, updated_at: datetime), @primary_key_name="project_id", @through_reflection=false, @macro=:has_many, @options={:extend=>[]}, @name=:tasks, @quoted_table_name="\"tasks\"", @class_name="Task", @active_record=Project(id: integer, name: string, created_at: datetime, updated_at: datetime)>} | |
>> | |
NewerOlder