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 AbstractModel < ActiveRecord::Base | |
self.abstract_class = true | |
end | |
class Foo < AbstractModel | |
end | |
class Bar < AbstractModel | |
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
NOTE: Gem.latest_load_paths is deprecated with no replacement. It will be removed on or after 2011-10-01. | |
Gem.latest_load_paths called from /Users/macpro/.rvm/gems/ruby-1.9.2-p180@veggie/gems/spork-0.8.5/lib/spork.rb:112. | |
NOTE: Gem.all_partials is deprecated with no replacement. It will be removed on or after 2011-10-01. | |
Gem.all_partials called from /Users/macpro/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:598. | |
NOTE: Gem.all_partials is deprecated with no replacement. It will be removed on or after 2011-10-01. | |
Gem.all_partials called from /Users/macpro/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:598. |
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
$ git clone github:lenary/guides.git | |
Cloning into guides... | |
remote: Counting objects: 255, done. | |
remote: Compressing objects: 100% (216/216), done. | |
remote: Total 255 (delta 111), reused 163 (delta 35) | |
Receiving objects: 100% (255/255), 1.49 MiB | 564 KiB/s, done. | |
Resolving deltas: 100% (111/111), done. | |
$ cd guides | |
$ git remote -v |
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
namespace :deploy do | |
task :fast do | |
run "cd #{current_path} && git pull origin #{branch} && touch #{current_path}/tmp/restart.txt; true" | |
end | |
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
require 'openid/store/filesystem' | |
ActionController::Dispatcher.middleware.use OmniAuth::Builder do | |
provider :twitter, 'key', 'secret' | |
provider :facebook, 'app_id', 'secret' | |
provider :linked_in, 'key', 'secret' | |
provider :open_id, OpenID::Store::Filesystem.new('/tmp') | |
end | |
# you will be able to access the above providers by the following url | |
# /auth/providername for example /auth/twitter /auth/facebook |
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
- No methods more than 10 lines | |
- Use database migrations | |
- after committing a db migration, don't change it. Just add Another migration | |
- Thin Controllers, Avoid sharing more than one or two instance variables b/w controllers and views | |
- use REST at all times | |
- Use one type of http request per action, do not use "request.post?" type methods. | |
- Avoid using comments. If unclear, Refactor. | |
- use "h" in views, to escape everything | |
- do not use abbreviations for variable names | |
- follow naming conventions don't use variable names like photoalbum use photo_album instead |
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
# Instance variables in models | |
# recently i came across code where a friend of mine had written a lot code in models like its below ( without any attr_reader or accessor ) , is this ok or just plain useless, | |
def coordinates | |
@coordinates = [latitude, longitude] | |
end | |
# should we do something like below make more sense | |
def coordinates |
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
# rubygems DNS is temporarily down, put this into your /etc/hosts to install gems, | |
# but don't forget to remove the entries once their DNS is back up again | |
72.4.120.124 rubygems.org | |
207.171.181.231 production.s3.rubygems.org | |
216.137.45.24 production.cf.rubygems.org |
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
fast: through middleware inserted at 0 | |
slwr: through middleware inserted via @use@ | |
rotr: through endpoint sent via the router | |
bare: through ActionController::Metal with self.response_body | |
cntr: through ActionController::Base with self.response_body | |
text: through ActionController::Base with render :text | |
tmpl: through ActionController::Base with simple render :template | |
layt: through ActionController::Base with render :template with layout | |
Note: These tests are being run without ActiveRecord, which currently |
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
Before("@culerity,@celerity,@javascript") do |scenario| | |
unless @env_rvm_jruby | |
@env_rvm_jruby = {} | |
require 'yaml' | |
rvm_info = YAML::load(`bash -l -c 'source ~/.rvm/scripts/rvm; rvm jruby ; rvm info'`) | |
rvm_info['environment'].each do |k, v| | |
@env_rvm_jruby[k] = v | |
end | |
@env_jruby_path = rvm_info['binaries']['ruby'].gsub(%r{^(.*)/ruby$}, '\1') | |
end |