Wednesday, January 6th, 2010

NoMethodError: Attempt to call private method in using Geokit rake task

Problem
Trying to use the rake task for populating latitude and longitude details for addresses as described in the Web mashup projects book, gives the error about attempting to call private method.
Solution
Use the method save instead of update as suggested in the book.

No Comments » - Posted in ruby on rails by kosmas

Wednesday, January 6th, 2010

NoMethodError: undefined method `timeout=’ for Geokit::Geocoders:Module

Problem
Using the latest version of Geokit gives the error for undefined method ‘timeout’. This could happen if the gem/plugin didn’t modify the config/environment.rb file, and you had to copy the configuration values from an older version.
Solution
The configuration variable has changed in the latest version (1.5.0) from timeout to request_timeout, so change it in your config/environment.rb [...]

No Comments » - Posted in ruby on rails by kosmas

Wednesday, September 9th, 2009

Pdf with .doc templates using prawn in Ruby on Rails

Problem
You want to generate pdf documents in your Ruby on Rails app using .doc templates.
Solution
Open the .doc document in OpenOffice and save it as an Open Document Format (.odt).
Open the saved .odt document and export to pdf, making sure you use ‘Losless compression’ in the General Options section.
Use imagemagick’s convert to make the pdf file [...]

No Comments » - Posted in ruby on rails by kosmas

Friday, September 4th, 2009

Rails XSS vulnerability

Problem
There was a warning about an XSS vulnerability in Ruby on Rails. More details can be found here.
Solution
Upgrade to the most recent (fixed) Rails version (2.3.4):
sudo gem install rails

1 Comment » - Posted in ruby on rails by kosmas

Monday, August 24th, 2009

RubyGem version error: rack(0.3.0 not ~> 1.0.0)

Problem
Trying to deploy in dreamhost with capistrano you get the error:
RubyGem version error: rack(0.3.0 not ~> 1.0.0)
Solution
Log in with ssh to your dreamhost account and then install the newer version of rack that is not yet installed in dreamhost:
gem install rack
That assumes that you have followed the instructions for setting up your local gems [...]

No Comments » - Posted in Dreamhost, ruby on rails by kosmas

Monday, June 29th, 2009

Mandriva – Eclipse – Aptana RadRails

Problem
You want to do a new installation of Aptana RadRails IDE in Mandriva as an eclipse plugin.
Solution

Install eclipse first (selecting openjdk when prompted):
sudo urpmi eclipse

According to the instructions here take the following steps:
From the Help menu in Eclipse, select Software Updates
Select the Available Sotware tab
Click the “Add Site..” button.
Specify the Location Url update site: http://update.aptana.com/update/studio/3.4/ [...]

2 Comments » - Posted in Mandriva, ruby on rails by kosmas

Wednesday, June 24th, 2009

undefined method `render_component’ with ActiveScaffold and Rails 2.3.2

Problem
When using a nested (or embedded) scaffold in ActiveScaffold with Rails 2.3.2 you have the error:
undefined method `render_component’
Solution
According to the issue here, in Rails 2.3 the render_component has been removed.
Install the render_component from:
script/plugin install git://github.com/lackac/render_component.git -r rails-edge
and restart your server, and it should be working.

1 Comment » - Posted in ActiveScaffold, linux, ruby on rails by kosmas

Friday, May 1st, 2009

Spree installation error in Mandriva.

Problem
You are trying to install spree from the git source, following the instructions from here, but there are errors like:
gem install activemerchant –version “= 1.4.1″
ERROR: While generating documentation for builder-2.1.2
… MESSAGE: Unhandled special: Special: type=17, text=”"
… RDOC args: –ri –op /usr/lib/ruby/gems/1.8/doc/builder-2.1.2/ri –title Builder
— Easy XML Building –main README [...]

No Comments » - Posted in Mandriva, linux, ruby on rails by kosmas

Monday, March 30th, 2009

Upgrading to 2.3.2 – Uninitialized constant ApplicationController

Problem
Upgrading from a previous version of Rails to the latest 2.3.2, you get an error:
NameError: uninitialized constant ApplicationController
both in the web browser and in console.
Solution
Since the introduction of Rails 2.3 the application.rb file has been renamed to application_controller.rb.
So in order to solve the problem just rename your file application.rb to application_controller.rb.
Thanks to the post here

2 Comments » - Posted in ruby on rails by kosmas

Thursday, February 19th, 2009

Using ActiveScaffold in Rails 2.2 after using default scaffolding

Problem
You want to use ActiveScaffold in Rails 2.2, in a model that you have created using the standard Rails scaffolding script.
Solution

Install the ActiveScaffold plugin:
script/plugin install git://github.com/activescaffold/active_scaffold.git -r rails-2.2

In your layout (model or application for all models) add the following:

In your controller file delete all the standard scaffolding code and add one line, so that your [...]

No Comments » - Posted in ruby on rails by kosmas