- Check if a page variable has been defined
-
Set variables in a page (page.html.haml) at the very biginning of the file:
--- variable: value variable2: value 2 ---
-
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
# Original method | |
#def process(input) | |
# if input == 'q' | |
# puts 'Goodbye' | |
# elsif input == 'tweet' | |
# puts 'tweeting' | |
# elsif input == 'dm' | |
# puts 'direct messaging' | |
# elsif input == 'help' |
In this article, I'll walk through a basic Rails (3.2.x) setup for creating a nested resource for two models. Nested resources work well when you want to build out URL structure between two related models, and still maintain a RESTful convention. This code assumes you are running RVM to manage Ruby/Gem versions, and Git for version control.
$ mkdir family # create rvm gemset
$ echo "rvm use --create ruby-1.9.2@family" > family/.rvmrc
$ cd family # install rails
$ gem install rails # create new rails project
$ rails new . # version control
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/logger_customizations.rb | |
# Production-only monkeypatches to make our logs awesome | |
# Monkeypatch 1 | |
# Don't log common poller-style requests, they are just noise | |
class CustomLogger < Rails::Rack::Logger | |
def initialize(app, opts = {}) | |
@app = app | |
@opts = opts | |
@opts[:silenced] ||= [] |