Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 472

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 487

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 494

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 530

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-includes/cache.php on line 103

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-includes/theme.php on line 623

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/custom_posts/custom_posts.php on line 22

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 46

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 67

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 75

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 92

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiRender.php on line 70

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 181

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 538

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 695

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 1087

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112
おれせか

おれせか

なんかそれっぽいのをうにうに。

sessionをmemcachedでやーろおっと思ってググてみたらDalliが良いカンジらしいとのこと。

というわけで書いてある通りにインスコしてcache設定してsession設定してってしてみたところ

`require’: cannot load such file — memcache (LoadError)

て言われちゃう。ぐぬぬ。

ちょろとググってみたところinitializers/session_store.rbの

Rails.application.config.session_store ActionDispatch::Session::CacheStore

これを

require 'action_dispatch/middleware/session/dalli_store'
Rails.application.config.session_store :dalli_store

てカンジでOKらしい。

けど、これだと環境毎のcache設定で切り替わらない気がする。(よく調べてないけど。)
というわけで、sessionのconfigは元に戻してー、何も考えずにエラーを見ての通り’memcache’がloadできればええんやろーってわけでGemfileに追記

gem 'memcache'

解決したぞう。わあい。

PAGETOP

調べたらすぐ出てきたけどいちおうメモっとく。

namespace :deploy do
  desc "Load the seed data from db/seeds.rb"
  task :seed do
    run "cd #{current_path}; bundle exec rake db:seed RAILS_ENV=#{rails_env}"
  end
end

↑deploy.rbでこんなん追加。

ichi% cap -T
〜略〜
cap deploy:seed              # Load the seed data from db/seeds.rb
〜略〜

capタスクに追加された。
これで「cap deploy:seed」でdeploy先で「rake db:seed」できる(はず)。

自分の場合、migrate後に勝手にやってほしいので、deploy.rbに以下を追加してる。

  after 'deploy:migrate', 'deploy:seed'

これでdeploy:coldなんかでdeploy:migrateが走った後にdeploy:seedも走るようになるよ!
わあい。

PAGETOP

kennyjのブログ(仮): rails3.0の頃からvalidationにコンテキストを指定できる様になってた

↑の記事を読んで、おおこりゃいいやと思いつつ使ってみた時に気づいたことメモ。

@hoge.update_attributes(params[:hoge], context: :foo)

何も考えずにupdate_attributesにも:contextオプション指定できるかなー?と思ってやってみた。
→ :updateコンテキスト(デフォ)扱いされる。

@hoge.attributes = params[:hoge]
@hoge.save(context: :foo)

attributes= してからsaveしてみた。
→ やったー。:fooコンテキスト扱いされたよー。

railsのdocumentちろっと見てみたらupdate_attributesの引数は1個しかないみたいなんで当たり前っちゃ当たり前なんですが、なんかrailsだとこのくらいサクっといけてしまうんじゃなかろうかて気がしたのでやってみたというね。

PAGETOP

Search