- watch for ActiveRecord Relation, like
has_many
,has_many :through
- watch for
user_roles
, `group_users - UPDATE
action
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
# rails | |
sdoc -x test -x example -x bin -N --main rails-3.2.13/README.rdoc --title "Rails 3.2.13" --op ~/Desktop/rails-3.2.13 rails-3.2.13 | |
# ruby (rbenv) | |
sdoc --main ruby-1.9.3-p392/README -x test -x example -x bin -N --title "Ruby 1.9.3" --op ~/Desktop/ruby-1.9.3 ~/.rbenv/sources/1.9.3-p392/ruby-1.9.3-p392 ~/.rbenv/sources/1.9.3-p392/ruby-1.9.3-p392/README | |
sdoc --main ruby-1.9.3-p392/README -x test -x example -x bin -N --title "Ruby 1.9.3" --op ~/Desktop/ruby-1.9.3 ruby-1.9.3-p392 ruby-1.9.3-p392/README | |
# not working yet | |
sdoc --main ruby-2.0.0-p195/README -x test -x example -x bin -N --title "Ruby 2.0.0" --op ~/Desktop/ruby-2.0.0 ~/.rbenv/sources/2.0.0-p195/ruby-2.0.0-p195 ~/.rbenv/sources/2.0.0-p195/ruby-2.0.0-p195/README |
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
# Tested in Ruby 1.8.7 | |
class ParentClass | |
def call_private_good | |
# Private methods can only be called without an explicit receiver | |
private_test | |
end | |
def call_private_bad | |
# Calling a private method with an explicit receiver (self) will fail |
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
######################################### | |
### Install wget-ssl over ipkg's wget ### | |
######################################### | |
$ ipkg install -verbose_wget libidn # To get ipk URL | |
$ ipkg install -verbose_wget wget-ssl # To get ipk URL | |
$ /usr/syno/bin/wget http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/libidn_1.25-1_i686.ipk | |
$ /usr/syno/bin/wget http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/wget-ssl_1.12-2_i686.ipk | |
$ ipkg install libidn_1.25-1_i686.ipk | |
$ ipkg install wget-ssl_1.12-2_i686.ipk |
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
# Setup | |
# ===== | |
# | |
# Put this gist in Rails.root/config/initializers/cancan.rb | |
# Add Squeel to Gemfile, see https://github.com/ernie/squeel | |
# | |
# gem "squeel", "~> 0.9.3" | |
# | |
# Load Squeel hash and symbol extensions in squeel config initializer | |
# |
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
# drop this in a ruby file in my_rails_app/config/initializers | |
# restart your rails and app you're good to go! | |
class String | |
# remove middle from strings exceeding max length. | |
def ellipsize(options={}) | |
max = options[:max] || 40 | |
delimiter = options[:delimiter] || "..." | |
return self if self.size <= max | |
remainder = max - delimiter.size |
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
Found this tip in comment here: http://www.tipb.com/2011/01/04/tipb-bug-home-button-working-iphone/ | |
1.) Open any application | |
2.) Press and hold the power button until the slide to shutdown swipe bar appears. | |
3.) Release Power button | |
4.) Press and hold Home button Lightly | |
until screen returns to icon screen |
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
__or_fn = lambda do |*scopes| | |
where = [] | |
joins = [] | |
includes = [] | |
# for some reason, flatten is actually executing the scope | |
scopes = scopes[0] if scopes.size == 1 | |
scopes.each do |s| | |
w = [] | |
s.where_clauses.each do |where_clause| |
NewerOlder