Skip to content

Instantly share code, notes, and snippets.

@ievgrafov
ievgrafov / gist:30fef46eae8bcec9fd27
Last active June 28, 2017 11:36
rails 4.2 comma as decimal sparator
# A monkey-patch that allows you to use comma as decimal separator in ActiveRecord
# Notice for rails 5.0: in Rails 5.0 module Type with all nested classes is moved into ActiveModel,
# so don't forget to substitute 'module ActiveRecord' with 'module ActiveModel' after update
module ActiveRecord
module Type
class Decimal
private
alias_method :cast_value_without_comma_separator, :cast_value
@me-vlad
me-vlad / thin.sh
Created March 18, 2012 03:41
init script for multiple thin instances with rbenv shared install
#!/bin/sh
# thin This shell script takes care of starting and stopping
# thin daemon from rbenv shared install
#
# chkconfig: 2345 85 15
# description: thin is an Ruby web server
# config: /etc/sysconfig/thin
### BEGIN INIT INFO
@henkm
henkm / gist:952240
Created May 2, 2011 19:55
Add new items via JQuery TokenInput / Ruby on Rails
#model (idea 100% stolen from ryanb)
def author_tokens=(ids)
ids.gsub!(/CREATE_(.+?)_END/) do
Author.create!(:name => $1).id
end
self.author_ids = ids.split(",")
end
# jquery.tokeninput.js