Archive for November, 2007

Friday, November 30th, 2007

cap deploy_with_migrations default behaviour

Problem
When using cap deploy_with_migrations, the default behaviour is to deploy with the migrations in the production environment.
Solution
To change this behavior add:

set :rails_env, “development”
in your config/deploy.rb

No Comments » - Posted in ruby on rails by kosmas

Monday, November 26th, 2007

Keeping uploaded files between deployments

Problem
You are using file_column plugin (or maybe another plugin?), to upload files in your ruby on rails application. Because the files are big you don’t want to have a different copy stored in your subversion repository for each different deployment version. You want to keep a common folder with all your uploaded files, and use [...]

No Comments » - Posted in ruby on rails by kosmas

Friday, November 16th, 2007

Adding icons to ActiveScaffold’s actions

Problem
You want to replace the standard text descriptions in ActiveScaffold’s actions with your icons.
Solution

Create a file called active_scaffold_overrides.css in ror_project/public/stylesheets
Copy the css code from ror_project/vendor/plugins/active_scaffold/frontends/default/stylesheets/stylesheet.css and paste it in to the file created in the previous step.
Create a directory my_images in ror_project/public/images/activescaffold to hold your images.
Copy to the new directory the images you want to [...]

2 Comments » - Posted in ruby on rails by kosmas

Thursday, November 8th, 2007

Controller testing in Active Scaffold

Problem
You need to have to functionally test your controller when you are using ActiveScaffold. There are pieces of code that tell you how to do that on a normal ror application (ie without ActiveScaffold), like recipe 7.17 on the Rails Cookbook, or a fragment of code in an Active Scaffold application, but they don’t have [...]

2 Comments » - Posted in ruby on rails by kosmas

Monday, November 5th, 2007

:int and :integer problem in Ruby on Rails migration

After spending some time trying to make a migration work, and having the error message coming back:
You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]
I’ve decided to do a google search for the specific problem, as it was working fine with other [...]

No Comments » - Posted in ruby on rails by kosmas

Friday, November 2nd, 2007

dhtmlcalendar in ActiveScaffold

To control the date format in dhtmlcalendar within ActiveScaffold in Ruby on Rails, to make the date of 2 November 2007 appear like 02-11-2007, use:
i) if you want to affect the settings in all the application add the following to the top of your controllers/application.rb

ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMAT[:default] = ‘%d-%m-%Y’
ii) If you only want to affect the [...]

No Comments » - Posted in ruby on rails by admin