$ rails g model User
belongs_to
has_one
# Ways to execute a shell script in Ruby | |
# Example Script - Joseph Pecoraro | |
cmd = "echo 'hi'" # Sample string that can be used | |
# 1. Kernel#` - commonly called backticks - `cmd` | |
# This is like many other languages, including bash, PHP, and Perl | |
# Synchronous (blocking) | |
# Returns the output of the shell command | |
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111 |
=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') |
# taken from http://railsbros.de/2010/11/29/a-custom-irbrc-for-rails-3.html | |
# config/application.rb that is | |
module MyApp | |
class Application < Rails::Application | |
# config stuff comes here | |
def load_console(sandbox=false) | |
super | |
if File.exists?(project_specific_irbrc = File.join(Rails.root, ".irbrc")) | |
puts "Loading project specific .irbrc ..." |
<% pages = sitemap.resources.find_all{|p| p.source_file.match(/\.html/) } %> | |
<?xml version="1.0" encoding="UTF-8"?> | |
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | |
<% pages.each do |p| %> | |
<url> | |
<loc>http://youdomain.com/<%=p.destination_path.gsub('/index.html','')%></loc> | |
<priority>0.7</priority> | |
</url> | |
<% end %> | |
</urlset> |
Press minus + shift + s
and return
to chop/fold long lines!
AllCops: | |
Exclude: | |
- bin/* | |
- config/**/* | |
- coverage/**/* | |
- db/**/* | |
- doc/**/* | |
- log/**/* | |
- public/**/* | |
- script/**/* |
#Goal Deploy your Rails App super easily with Dokku on Digital Ocean cheap cheap!
##Notes
Procfile
with the command to start up your application serverLogentries
(not in this guide)AppSignal
or New Relic
(not in this guide)// from https://github.com/Shopify/liquid/blob/63eb1aac69a31d97e343822b973b3a51941c8ac2/performance/shopify/shop_filter.rb#L100 | |
Shopify.handleize = function (str) { | |
str = str.toLowerCase(); | |
var toReplace = ['"', "'", "\\", "(", ")", "[", "]"]; | |
// For the old browsers | |
for (var i = 0; i < toReplace.length; ++i) { | |
str = str.replace(toReplace[i], ""); | |
} |