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
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
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
- Basic Guides(awesome reference): | |
http://guides.rubyonrails.org/active_record_querying.html | |
http://guides.rubyonrails.org/active_record_basics.html | |
- Short Screencast: | |
http://railscasts.com/episodes/202-active-record-queries-in-rails-3 | |
- More complete guide: | |
http://www.theodinproject.com/ruby-on-rails#section-advanced-forms-and-active-record | |
http://www.theodinproject.com/ruby-on-rails/active-record-queries |
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
[user] | |
name = Mauricio Voto | |
email = mauriciovoto@gmail.com | |
[core] | |
excludesfile = /Users/mvoto/.gitignore_global | |
editor = /usr/bin/vim | |
[difftool "sourcetree"] | |
cmd = opendiff \"$LOCAL\" \"$REMOTE\" | |
path = | |
[mergetool "sourcetree"] |
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_ENV=production rake db:setup | |
# produces the error below.....hmmm.....it's a no-worky | |
psql:/yourprojectpath/yourproject/db/structure.sql:29: ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/hstore.control": No such file or directory | |
# hstore postgresql extension needs to be installed, so.... | |
sudo apt-get install postgresql-contrib | |
# now your extension should be available to enable so log in with psql | |
psql -d yourproject_production -U yourdbuser -W |
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
# Ubuntu as the base image | |
FROM ubuntu:trusty | |
# Install core tools | |
RUN apt-get -y update | |
RUN apt-get -y install git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev | |
# Install nginx | |
RUN apt-get -y install curl nginx |
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
#RVM | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" | |
function ruby_version { | |
ruby -e '/(.*)\/(.*)/.match(`echo $GEM_HOME`);print ($2.nil? ? "" : $2)' | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} |
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
Current: | |
* Clean Code | |
* Crafting Rails Applications | |
Next: | |
* Domain-driven Design | |
* Design Patterns in Ruby |
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
# config/initializers/will_paginate.rb | |
module WillPaginate | |
module ActionView | |
def will_paginate(collection = nil, options = {}) | |
options[:renderer] ||= BootstrapLinkRenderer | |
super.try :html_safe | |
end | |
class BootstrapLinkRenderer < LinkRenderer |
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 Array | |
def by(n) | |
buff, self_ = [], self.clone | |
if self.size % n == 0 | |
(self.size/n).times{ buff << self_.shift(n) } | |
end | |
buff | |
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
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
function proml { | |
local BLUE="\[\033[0;34m\]" | |
local RED="\[\033[0;31m\]" | |
local LIGHT_RED="\[\033[1;31m\]" | |
local GREEN="\[\033[0;32m\]" | |
local LIGHT_GREEN="\[\033[1;32m\]" |
OlderNewer