RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: elgalu
Agree with that eager loading. More on that: #22 Eager Loading (revised)
I think the intention of the screencast was to show how to use Dalli and not to focus on how to improve that example webpage.
The cache keys need to be unique in order to fetch its value later on.
So category_id is different for each category.
Think of the array [:category, category_id, :name] as syntactic sugar for what ends up being a cache key string.
[:category, category_id, :name]
"category/3/name" # the key that caches the category's name for the category_id 3
"category/4/name" # the key that caches the category's name for the category_id 4
"category/5/name" # the key that caches the category's name for the category_id 5
and so on...
By checking the docs Action Mailer - Receiving Emails you'll see that no receivers are provided, i.e. nor POP3 or Maildir built-in support.
You need to somehow trigger the ActionMailer recieve method every time an email is received, e.g.
rails runner 'UserMailer.receive(STDIN.read)'
Mailman solves that for you but ActionMailer doesn't, you would need to write your own Maildir Guard plugin and/or a POP3 polling daemon to call UserMailer.receive
gem 'capybara', '~> 2.1'
gem 'capybara-mechanize', '~> 1.1'
Capybara.configure do |config|
config.run_server = false
config.default_driver = :mechanize
config.app = "" # to avoid this error: ArgumentError: mechanize requires a rack application, but none was given
config.app_host = "http://railscasts.tadalist.com"
# Including Capybara::DSL in the global scope is not recommended but for the sake of this example:
fill_in "password", :with => "secret"
# etc.. capybara cheat sheet: https://gist.github.com/zhengjia/428105
You can replace capybara-mechanize with any other headless capybara driver, e.g. poltergeist or capybara-webkit
My preferred configuration management tools.
Using them always with your .env file either on development or production, in heorku or VPS, with rake or capistrano, on Rails or any app.
gem 'dotenv-rails', :groups => [:development, :test]
task :mytask => :dotenv do ... end
cp .env.example .env