Usage $ rails app_name -m ./ahabman_template.rb
Category Archives: rails
ruby on rails – has and belongs to many view plugin
So I’ll never have to write another has_and_belongs_to_many view again, here’s a plugin that dynamically makes 2 <ul> lists which you drag and drop both ways to manage the association. http://svn.ahabman.com/public/many_to_many_view/ From the readme: Assumming you have an @project var and you want to associate people with it. “shared/m2m”, :locals => { :thing => @project, [...]
You can’t use class variables in rails.
You can’t use class variables in rails. Unless you’d like to develop in production mode (specifically with config.cache_classes = true). In development mode all classes are reloaded on each request, which clears all class variables. I had the perfect place to use them – while running a mass synchronization, and needing to store the timestamp [...]
ruby csv to structured hash
I had a csv like this: object color flavor shape apple red sweet round banana yellow sweet long lemon yellow sour round and I wanted a ruby hash structured like this: So I wrote this, which does the job:
Ruby conversion module
This is a ruby module useful for conversions dealing with length, weight, torque.
Rails redirect_to :back in Internet Explorer
Today I realized that the rails command redirect_to :back does not work in Internet Explorer because redirect_to :back depends on the HTTP_REFERER http header, which IE does not send. I was capturing an onclick event with jQuery and was able to sending along the current URL as a query string, which provided an easy way [...]
Rails background process – simple, fast, easy.
My situation was this – Rails 2.0 app running on slicehost (ubuntu 8.04) in passenger mod_rails The goal was Dynamic PDF generation for a product catalog ( > 100 pages) This event had to be triggered from within the rails request / response cycle, but run outside of it I needed the simplest, fastest, more [...]
mod_rails set RAILS_ENV variable to QA, Staging, or Production
I’m using mod_rails with capistrano and multi-stage (qa, staging, production), and wrote this workaround so that the RAILS_ENV could be set correctly in each stage. Mod_rails sets RAILS_ENV once in the global server conf file, but I needed it set once for each environment: qa, staging, and production. I tried setting ENV['RAILS_ENV] in each file [...]