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.
For example:
ruby
"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
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
require 'capybara'
require 'capybara/mechanize'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"end# Including Capybara::DSL in the global scope is not recommended but for the sake of this example:
include Capybara::DSL
visit "/session/new"
fill_in "password", :with => "secret"
click_button("Sign in")
# etc.. capybara cheat sheet: https://gist.github.com/zhengjia/428105
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.
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.For example:
and so on...
+1
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.
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
Update:
Bonsai Elasticsearch
Using capybara for web scraping
You can replace capybara-mechanize with any other headless capybara driver, e.g. poltergeist or capybara-webkit
Foreman + dotenv + dotenv-rails + heroku-config
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.Rails 3 / 4 with dotenv-rails
Rails + Heroku with heroku-config
Rails + Capistrano with dotenv-capistrano
require "dotenv/capistrano"
Plain old Ruby apps with dotenv
Rake tasks
Note: do not commit your
.env
file but commit the example