RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: ches
Thanks for taking the time to make these improvements, and especially to give the detailed explanatory commit messages Karel, they're really helpful.
For anyone still referencing this, current ActiveRecord versions now have a reset_counters convenience class method that will automatically execute a count query for you. Also, please do use find_each instead of find(:all).each :-)
I'm not wild about using migrations to modify data personally, but if you insist:
add_column :projects, :tasks_count, :integer, :default => 0
Project.select(:id).find_each do |p|
Project.reset_counters p.id, :tasks
remove_column :projects, :tasks_count
You can easily have the best of both worlds -- I rather like Foreman's log presentation for the various processes, so I actually run Guard at the end of a Procfile, and use an environment variable to limit groups if I wish:
guard: bundle exec guard start $([ -n "$GUARDS" ] && echo "-g $GUARDS")
This way you could also employ guard-process as you mention for things that should restart when code is changed.
If you use your Procfile for production -- either on Heroku or to generate upstart/init files at deploy -- you'll want a separate Procfile for including Guard in development. I'm too lazy to type foreman -f config/dev/Procfile all the time so I wrap that in a rake dev task.
foreman -f config/dev/Procfile
At just about the time you asked this, the plugin author implemented the propertyToSearch configuration option for this :-)
I added a dirty instance_eval hack to make Hirb.disable/enable work in-session:
cldwalker is probably opinionated about Ripl, but I'll ask if he'll accept a patch to Hirb for built-in Pry support.
Edit: Just found this issue where he indeed says he doesn't want to support more shells in the gem itself (and you guys originally shared this .pryrc snippet =]).
Thank you! I took Pry for a spin several weeks ago but didn't take the time to fully explore getting Hirb working so I haven't been using it for Rails' console. I think I will now :-)
Small note: from the looks of the jQuery API docs and source, it doesn't appear that jQuery.support.localStorage actually works -- they note that the feature detection is mostly aimed at a small set of features needed for jQuery core and plugins.
Modernizr is a nice straightforward solution for simple yet pretty comprehensive feature detection that I'm finding very handy for graceful HTML5 degradation: