Rails表題の通り、なぜか Scaffold で作った date_select が動かなかったので。Can't convert Symbol into String だそうなので、エラーを追いかけるとどうやら config.i18n.default_locale = :ja とした時に date_select にきちんと値が渡らなくなる様子。該当... 続きを読む
単に新しい方がよい、ってわけでもないみたいです。 RSpec RSpec - Relish bundle install に成功していれば rails g コマンドに rspec:install が現れる*3ので、これを使って spec の雛形を用意します。 $ rails g rspec:install まだ実際に spec を書いたこと... 続きを読む
Learning and meeting with Ruby and Ruby-on-Rails enthusiasts.Learning and meeting with Ruby and Ruby-on-Rails enthusiasts. 続きを読む
Is there a way to disable SQL query logging when I'm executing commands in the console? Ideally, it would be great if I can just disable it and re-enable it with a command in the console. I'm trying to debug something and using "puts" to prin... 続きを読む
To cite from http://weblog.rubyonrails.org/2011/12/6/what-s-new-in-edge-rails-explain/ New applications get config.active_record.auto_explain_threshold_in_seconds = 0.5 in config/environments/development.rb. Active Record monitors queries and... 続きを読む
My app works pretty much perfectly in production – the website part of it, at least. The problem only pops up when I SSH into my VPS and do "rails c RAILS_ENV=production". The console works fine in development mode. I've had this problem bef... 続きを読む
Ruby本番環境などである部分の処理を一時的に確認したいとき。 Rails.logger.level = Logger::DEBUG # some process Rails.logger.level = Logger::INFO touch tmp/restart.txt で再起動すると、ログでSQLなどが確認できます。定数の中身は以下。DEBUG = 0INFO ... 続きを読む
キャッシュの保存先の設定(cache_store) 説明 キャッシュの保存先の設定 使い方 config.cache_store = 保存先 例 memcachedに保存 config.cache_store = :mem_cache_store ログファイルに色をつけない(colorize_logging) 説明 ログファイルに色をつけない 使い... 続きを読む
2009年09月17日07:05 Ruby Railsでindex_byを使ってハッシュ形式のデータを受け取る rails を使っていてデータを取得したとき、配列の形でデータが返ってきて使いづらいよ〜っていうときがあります。特定の値を持ってるデータにアクセスしたいときとか。 # find... 続きを読む
Very simple question here - if migrations can get slow and cumbersome as an app gets more complex and if we have the much cleaner rake db:schema:load to call instead, why do migrations exist at all? If the answer to the above is that migratio... 続きを読む
phpproのQ&A掲示板で下記の質問を読みました。 ログインの際に、クッキーにログイン情報を保存し、ログアウトの際には、フォームタグの中でPOSTでログアウトの為の値を飛ばし、値を受け取ったらクッキーの有効期限をマイナスにしてクッキー情報を消すというログ... 続きを読む
FlexやRuby on Railsなどで使い方とかを自分が後でわかるようにメモしておくブログ。最近はFlex系に飽きてます。 カテゴリ: Rails Resqueでのhookの使い方 Resqueを使う上で、enqueueする前に何かしたいなーやpeformされる前に何かしたいなーということはないで... 続きを読む
jQuery Mobile | jQuery Mobile を使って Ruby on Rails で作ったWebサイトを iPhoneなどのスマフォに対応したサイトに変更してみました。以下の画像は Ruby on Railsの Scaffold で作ったサイトをjQueryMobile対応した後の画面です。クールなスマフォサイトに... 続きを読む
Many Rails helpers take multiple hash arguments. The first is usually the options to control the helper itself, and the second is the html_options where you specifiy custom ids, classes etc. The method definition looks like this: collection_s... 続きを読む
You’re reading Signal vs. Noise, a publication about the web by 37signals since 1999. 37signals Different models in your Rails application will often share a set of cross-cutting concerns. In Basecamp, we have almost forty such concerns with... 続きを読む
公開日時: 2011-03-08 05:58 Rails 2.3.3からupdated_atのタイムスタンプを更新できます。 user.updated_at #=> "Wed Jan 27 23:29:22 +1300 2010" user.touch user.updated_at #=> "Wed Jan 27 23:30:08 +1300 2010" 関連する親モデルのupdated_atも更新する場... 続きを読む
http://blog.nakajijapan.net/archives/3135/feed 0 rbenv http://blog.nakajijapan.net/archives/3121 http://blog.nakajijapan.net/archives/3121#comments Mon, 30 Jan 2012 17:06:16 +0000 monyu http://blog.nakajijapan.net/?p=3121 http://blog.nakajija... 続きを読む
2012年05月10日11:00 Ruby Linux CentOS6.2 に Rails + Nginx + Unicorn な環境を作った 必要になって久しぶりに環境作りました。にしても、しばらく触ってなかったからかいろいろ忘れてて大変でした。今度のために簡単にまとめておきます :D ネットワーク まず... 続きを読む
次のページ カテゴリへ戻る ヘッダー情報で取得できる情報(request.env) 更新日 2009/06/03 作成日 2008/08/07 ページにアクセスしたとき、さまざまなデータがリクエストヘッダ情報としてサーバに送られています。これらの情報はサーバ側で以下のように参... 続きを読む