Tortoise SVN using SVN+SSH from Windows to your Linux box.

Being that I found this solution as a compilation of info from various sources, most of which are heck of a lot smarter than I am, I have to take ZERO responsibility for any inaccuracies in this information that may compromise the security of your systems. Getting this to work is relatively new to me and there could be a few ‘holes’ in the setup that I am just not aware of. I have tried my best to make sure that what has been done is as stable as possible, but I’m only human.

For this HOW-TO I make the assumption that you are hosting the repository on a Linux box (Go Ubuntu!) and connecting to it from Windows using Tortoise SVN. The repository you are using should already be created, and, you will need a shell account (ssh) on the machine you are connecting to. I chose to use my own shell account and not create a ’stand alone’ svn account for this purpose.

[Read more →]

ActionView::ActionViewError (No rhtml, rxml, rjs or delegate template found for XXX)

Here’s how it goes. (This is a summary of a thread that was ongoing on Rails list on the Ruby Forums site.)

The ‘empty_cart’ action works perfects if a button/link clicked from the site. Calling ‘remove_from_cart’ works perfectly EXCEPT when the item being removed is the LAST item in the cart. When that happens I want to (redirect?) the call to remove_from_cart to the empty_cart action and then have the associated empty_cart.rjs template rendered, NOT the one that Rails would render [by default] “remove_from_cart.rjs”.

[Read more →]

Remember… ruby classes are interpreted.

I came across a small bug that actually had me stumped WHY it was happenning. Here’s some code.

This class works when used in my app.

class Order < ActiveRecord::Base
PAYMENT_TYPES = [
[ "Check", "check" ],
[ "Credit card", "cc" ],
[ "Purchase order", "po" ]
]
has_many :line_items
validates_presence_of :name, :address, :email, :pay_type
validates_inclusion_of :pay_type, :in => PAYMENT_TYPES.map {|disp,
value| value}
end

But this doesn’t:

class Order < ActiveRecord::Base
has_many :line_items
validates_presence_of :name, :address, :email, :pay_type
validates_inclusion_of :pay_type, :in => PAYMENT_TYPES.map {|disp,
value| value}
PAYMENT_TYPES = [
[ “Check”, “check” ],
[ “Credit card”, “cc” ],
[ “Purchase order”, “po” ]
]
end

Here is the error in the logs.

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:477:in
`const_missing'

Well the reason for my confusion is Java. Java loads (compiling first) all class “definitions” into the VM and are access / created when instantiated. You can define something in a Java class AFTER it’s been used because all definitions are in memory and found when instantiated anyway.

Ruby, being an interpreted language, doesn’t do this, it executes the class definition line by line. Since we have a ’static’ or ‘class’ initializer AFTER the validator, the validator can’t find a reference for PAYMENT_TYPES. Thus moving the Map to the top of the class corects the problem.

Interesting and an obvious sign that I’ll have to ‘think in Ruby’ when coding Ruby.

Something done put mah dawg down! (Mongrel died today)

Well let’s chalk this up to one of the craziest things I’ve seen.

I have been using Mongrel as my Rails server for a few months without a single hassle from day 1 but today I decided that I would upgrade my Aptana IDE and it had some new fangled Radrails update to perform also. Once that was done, hell broke lose. Can’t really blame it on Aptana without proof, but it’s a little suspicious.

[Read more →]