Testing Rails application with ActsAsAuthenticated plugin

Acts As Authenticated plugin is first choice when You want add authentication to Your Rails application. Next step is to add some test to Your code (everybody writes tests, right?). But looks like Google have no clue for newbies how to setup. So here comes simple recipe: when You add ActAsAuthenticated plugin to Your app, …

Saving objects and :id revisited

After I have discovered proper order object saving I read a little Rails documentation and… When Your app model have has_many and belongs_to (in my case Route has_many :points and Point belongs_to :rotue) Rails extends Your objects and in particular for Point adds property route which can be assigned with Route object. Like that: pt.route …

First save, then use :id

Well. Sometimes not all obvious things are so obvious ;-)) When creating some ActiveRecord objects, remember first to save it before using its :id. Lets look at this code: rt = Route.new pt = Point.new pt[:route_id] = rt[:id] rt[:name] = “New one” rt.save pt.save Will this work? It will depend on this what You expect …

How to start debug Ruby programs?

Last days I was busy in my free time with some strange error in Ruby on Rails. Or probably with my own application, rather Rails itself. Problem which I’m trying to solve is described in more details in this post to Ruby Forum. In short – my app encounter some strange delay when I’m sending …

Debugging HTTP

For all Windows folks tool written by Microsoft, which can be useful for debugging any HTTP related stuff. Fiddler (http://www.fiddlertool.com/fiddler/) is a local proxy, with nice interface for inspecting all traffic. So, when You debug some HTTP related issues, install on client this tool (requires .NET v 1.1 Framework) and redirect traffic to this proxy. …