bits about life, coding and stuff
Got an strange error: invalid value for Integer "09" What did I do? (…)Integer(somestring)(…) where somestring was something between 01-99. Turns out that an leading zero tells ruby that this is octal. Hell, I don’t have any octal stuff in my web app. Solution: Do it the ruby way, use .to_i – even cleaner, and [...]
In the java world, you have setter and getter in your model which are called ALWAYS. Change some behaviour in the setter/getter and you are done. Things are somewhat more complicated if we look at rails and activerecord. Imagine you have a model that should parse both minutes and a formatted hour/minute string as data: [...]
If you want to show _when_ the app has been deployed with capistrano, this snipped might come in handy: ############################################################# # Custom Tasks ############################################################# set :version_file, "#{tcdb_path}/app/views/layouts/_version.html.erb" namespace :my_tasks do desc "Sets the timestamp in version_file" task :set_version_info do run "rm #{version_file}" run "echo ‘#{Time.now}’ >> #{version_file}" end end after ‘deploy:symlink’, ‘my_tasks:set_version_info’ One more [...]
…because ssh’in and updating all this code manually is so 2006. Enter Capistrano! It’s for web what make is for c. It’s simple, widely used and even those php kids begin likein’ it! A tool which make subsequent deployments to your webserver much easier.
Ever wondered what “freeze your gems” is all about? Most rails app depend heavily on gems (rails itself is a gem!) and we somehow need to make sure that everything works together. And you really should care about this.