2/26/2006

Another Hour Another Rails Release

While I am a complete novice at this and my controller tests still don't work I have been able to add basic delete and create functionality to "WebZone On Rails" in about 5 hours.

The reason I couldn't do this in Java is because of ActiveRecord and the tight integration between the controller and the page.

With ActiveRecord I have been able to create and delete from an existing MySQL schema with just a couple of lines of code. With the integrated mock data infrastructure that comes with Rails I have full unit tests for all these steps.

With the tight integration of controller and page I am able to create controller instance variables and directly reference them from the rhtml pages. This makes it mind blowingly easy to load data and reference that data directly on the page while maintaining the MVC isolation. This is similar in concept to the .Net idea of the page and code behind being the same instance.

I still can't run my controller tests. Ran the gem update rails with no improvement.

Blog Entry From Camera Phone

Trying the mobile blogging feature at blogger.com. Just have to send an email to go@blogger.com and 'they do the rest'. Sound too easy.

Publishing Rails with SwitchTower

I need a simpler way to get my changes out to the web site. currently I am just copying file by file to FTP but this is tedious and error prone. I have heard that Switch Tower is the tool of choice for deploying Rails apps so here goes:


gem install switchtower


The install seemed to go well with the following dependencies also being installed.


Attempting local installation of 'switchtower'
Local gem file not found: switchtower*.gem
Attempting remote installation of 'switchtower'
Updating Gem source index for: http://gems.rubyforge.org
Install required dependency net-ssh? [Yn] y
Install required dependency needle? [Yn] y
Install required dependency net-sftp? [Yn] y
Successfully installed switchtower, version 1.0.1


Switch Tower needs to make some changes to the current rails app so that it can deploy it.


switchtower --apply-to [full path to rails app]


This seems easy enough but the first run gives me this. After a hour of google searching and drilling down into the gem install I find that the error, is infact, correct, the rails_generator/sripts/generate code does not exist as part if the switchtower install but I don't know where to get it so I am stuck.


d:/products/ruby-1.8.2-14/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:
in `require__': No such file to load -- rails_generator/scripts/generate (Missin
gSourceFile)
from d:/products/ruby-1.8.2-14/lib/ruby/site_ruby/1.8/rubygems/loadpath_
manager.rb:5:in `require'
from d:/products/ruby-1.8.2-14/lib/ruby/gems/1.8/gems/activesupport-1.2.
5/lib/active_support/dependencies.rb:214:in `require'
from d:/products/ruby-1.8.2-14/lib/ruby/gems/1.8/gems/switchtower-1.0.1/
lib/switchtower/generators/rails/loader.rb:7:in `load!'
from d:/products/ruby-1.8.2-14/lib/ruby/gems/1.8/gems/switchtower-1.0.1/
lib/switchtower/cli.rb:248:in `execute_apply_to!'
from d:/products/ruby-1.8.2-14/lib/ruby/gems/1.8/gems/switchtower-1.0.1/
lib/switchtower/cli.rb:219:in `execute!'
from d:/products/ruby-1.8.2-14/lib/ruby/gems/1.8/gems/switchtower-1.0.1/
lib/switchtower/cli.rb:12:in `execute!'
from d:/products/ruby-1.8.2-14/lib/ruby/gems/1.8/gems/switchtower-1.0.1/
bin/switchtower:11
from d:/products/ruby-1.8.2-14/bin/switchtower:19:in `load'
from d:/products/ruby-1.8.2-14/bin/switchtower:19

WebZone port to Rails

I have been using a product called WebZone since 2001. I built it to do what I want and have extended for me. It supports other users and sharing data with them but primarily it has always been for me.

Its primary goal is to allow me to collect information in one place and organize it. It does this with good support for drag and drop into the browser, JavaScript scriptlets that can add the current page to your WebZone account and the ability drag your information around your WebZone to relate it in anyway that you want.

WebZone on Java



At 5 years old it needs some serious re-writing. When I started it I was just getting into test first so it doesn't have many tests. It has no mock data so continuous testing is out.

Since Rails is getting so much press I have decided to try it our there.

Phase One. Allow a rails app to read and navigate a WebZone database.

Phase Two. Add edit feature.

Phase Three. Add delete feature.

Phase Four. Add create feature.

We are in Phase three and it is now deployed to

WebZone on Rails



So far so good.

The basic app was easy to create but I needed some ActiveRecord help from the XP Cincinnati team to get the database interface working nicely. Thanks to Jim Weirich.

With that part working, putting the rhtml files together to display the data was a snap.

A continuing problem is getting the controller tests working. So I am doing as much unit testing as possible but not being able to test the controller level is a serious problem. I am getting the error:


Exception: No url can be generated for the hash
{:targetId=>"1", :controller=>"read", :action=>"item", :targetType=>"TableText"}
generated_code/routing/generation.rb:5:in `generate_default_path'
.../action_controller/routing.rb:419:in `send'
.../action_controller/routing.rb:419:in `generate_path'
.../action_controller/routing.rb:415:in `generate'
.../action_controller/routing.rb:602:in `extra_keys'
.../action_controller/test_process.rb:86:in `assign_parameters'
.../action_controller/test_process.rb:295:in `process'
.../action_controller/test_process.rb:307:in `get'
webzone3/test/functional/read_controller_test.rb:20:in `test_item'