shared items

Thursday, November 12, 2009

Removing Stale Rails Sessions

Source : http://www.realityforge.org/articles/2006/03/01/removing-stale-rails-sessions

CGI::Session::ActiveRecordStore

if you upgrade to Rails 2.3, the session management has
changed significantly, per the release notes:

CGI::Session::CookieStore has been replaced by ActionController::Session::CookieStore.
CGI::Session::MemCacheStore has been replaced by ActionController::Session::MemCacheStore.
CGI::Session::ActiveRecordStore has been replaced by ActiveRecord::SessionStore.

soap4r + rails + uninitialized constant error

http://rubyglasses.blogspot.com/2008/10/soap4r-rails-cant-find.html

Will_paginate + ajax

Good tutorial found at http://weblog.redlinesoftware.com/2008/1/30/willpaginate-and-remote-links

Friday, October 30, 2009

Google charts ( Charts, Maps, ...)

The Google Chart API lets you dynamically generate charts. To see the Chart API in action, open up a browser window and copy the following URL into the address bar: http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World
Press the Enter or Return key and - presto! - you should see the following image:
Yellow pie chart

http://code.google.com/apis/chart/

Friday, October 23, 2009

Win32::Service::Error: Access is denied.

Win32 access denied

Rob Stiff
Tue, 19 Aug 2008 07:27:31 -0700

Rob Stiff wrote:
> Using the Win32 HOWTO information, I am attempting to start the service.
> upon the service::install command, I receiving the error 'Access is
> denied. (Win32::ServiceError).
>
> The error is occurring in line 146 of init.rb
>
> Version Information:
> Ruby 1.8.6
> Rails 1.2.0
> Gem 1.2.0
> Win32-Service 0.5.2
> Mongrel_service 0.3.4
> OS - Windows Vista
>
> There is a newer version of Win32 available (0.6.1), but this version is
> incompatible with mongrel_service and issues a version error.
>
> Thanks in advance!

SOLVED.
The issue was with Windows Vista. You must always run the command line
by right-clicking and using the "Run as Administrator" option.

Wednesday, October 21, 2009

classic pagination in Rails

Action Pack pagination for Active Record collections

DEPRECATION WARNING: Pagination will be moved to a plugin in Rails 2.0. Install the classic_pagination plugin for forward compatibility:

script/plugin install svn://errtheblog.com/svn/plugins/classic_pagination

The Pagination module aids in the process of paging large collections of Active Record objects. It offers macro-style automatic fetching of your model for multiple views, or explicit fetching for single actions. And if the magic isn‘t flexible enough for your needs, you can create your own paginators with a minimal amount of code.

The Pagination module can handle as much or as little as you wish. In the controller, have it automatically query your model for pagination; or, if you prefer, create Paginator objects yourself.

Pagination is included automatically for all controllers.

For help rendering pagination links, see ActionView::Helpers::PaginationHelper.
Automatic pagination for every action in a controller

class PersonController < ApplicationController
model :person

paginate :people, :order => 'last_name, first_name',
:per_page => 20

# ...
end


Source : http://api.rubyonrails.org/classes/ActionController/Pagination.html