msgbartop
Useful MOSS 2007 and Ruby and Rails stuff
msgbarbottom

18 Feb 09 How to: Install Memcached on Ubuntu for Rails

sudo aptitude install memcached

sudo aptitude install libmemcache-dev

sudo gem install RubyInline

sudo gem install memcache-client

in application.rb

Uncomment the protect_from_forgery

in environment.rb

CACHE = MemCache.new ‘localhost:11211′, :namespace => ‘your_app’

config.action_controller.session = {
:session_key => ‘_your_app_session’,
:secret      => ‘yoursecrectkey’,
:cache       => CACHE,
:expires=>900  }

config.action_controller.session_store = :mem_cache_store

Tags: ,

25 Dec 08 Attach images in rails

View the railscast on using thoughtbot’s paperclip

http://railscasts.com/episodes/134-paperclip

or

attach multiple images to a model using polymorphic paperclip

http://burm.net/2008/10/17/ruby-on-rails-polymorphic-paperclip-plugin-tutorial/

Tags:

15 Dec 08 Learning how to use Shoulda

View the conf video to find out what Shoulda is

http://mwrc2008.confreaks.com/12saleh.html

Shoulda Walkthrough

http://technicalpickles.com/posts/a-walk-through-of-test-driven-development-with-shoulda

Read the thoughtbot tutorials

http://thoughtbot.com/projects/shoulda/tutorial

Tags: ,

08 Dec 08 Rails export to excel spreadsheet

sudo gem install spreadsheet

more help:

http://codeclimber.blogspot.com/2008/11/reporting-in-excel-with-rails.html

http://spreadsheet.rubyforge.org/

To send and save through browser

Taken from https://rubyforge.org/forum/forum.php?thread_id=29606&forum_id=2920

require ’stringio’
data = StringIO.new ”
book.write data
send_data data.string, :type=>”application/excel”, :disposition=>’attachment’, :filename => ‘MeaningfulName.xls’

Tags: ,

04 Dec 08 Send email in rails

http://railscasts.com/episodes/61

Tags: ,

04 Dec 08 Rails sending email Net::SMTPFatalError

From: http://readlist.com/lists/lists.rubyonrails.org/rails/3/15740.html

Configuring local_recipient_maps in main.cf
The local_recipient_maps parameter specifies lookup tables with all
names or addresses of local recipients. A recipient address is local
when its domain matches $mydestination, $inet_interfaces or
$proxy_interfaces. If a local username or address is not listed in
$local_recipient_maps, then the Postfix SMTP server will reject the
address with “User unknown in local recipient table”.

The default setting, shown below, assumes that you use the default
Postfix local(8) delivery agent for local delivery, where recipients
are either UNIX accounts or local aliases:

/etc/postfix/main.cf:
local_recipient_maps = proxy:unix:passwd.byname $alias_maps
To turn off unknown local recipient rejects by the SMTP server, specify:

/etc/postfix/main.cf:
local_recipient_maps =
That is, an empty value. With this setting, the Postfix SMTP server
will not reject mail with “User unknown in local recipient table”.

Tags:

19 Nov 08 Installing Webmin / Virtualmin on Slicehost Ubuntu 8.04

After trying out various web control panels, I finally settled on webmin.

I was looking for an open source / free web control panel that would allow users easily set up websites via virtual hosts and ftp accounts

Here are the steps to get it up and running quickly. This has to be done on a fresh new slice and not one that is already hosting other websites.

  1. This assumes you have created a Ubuntu 8.04 slice 
  2. Set it up as per instructions here: 
    http://articles.slicehost.com/2008/4/25/ubuntu-hardy-setup-page-1
    http://articles.slicehost.com/2008/4/25/ubuntu-hardy-setup-page-2 
  3. The fastest way to set up Virtualmin using the install script:
    http://www.webmin.com/vinstall.html

    $ wget http://software.virtualmin.com/gpl/scripts/install.sh
    $ chmod +x install.sh
    $ sudo ./install.sh 

    That’s all! You’ll be able to view your site via https://xxx.xxx.xxx.xxx:10000
     

  4. I’ve managed to set it up with rails too following the instructions here:
    http://articles.slicehost.com/2008/5/6/ubuntu-hardy-apache-rails-and-thin

Tags: ,

04 Nov 08 Install RMagick on Ubuntu Hardy Heron

sudo aptitude install imagemagick

sudo aptitude install libmagick9-dev

sudo gem install rmagick

sudo gem install mini_magick

Install RMagick on OSX

http://benr75.com/articles/2008/03/16/install-rmagick-on-mac-os-x-leopard-from-source

Tags:

21 Sep 08 Rails Pagination

From :

http://github.com/mislav/will_paginate/tree/master

Installation

script/plugin install git://github.com/mislav/will_paginate.git

Usage

@posts = Post.paginate :page => params[:page], :o rder => 'created_at DESC'

In the view, page links can be rendered with a single view helper:
<%= will_paginate @posts %>

Technorati Tags:

Tags: , ,

16 Sep 08 Updating Ruby Gems and Upgrading Rails

For the gems

gem update –system

Upgrading Rails

gem install rails –version 2.1.1

Tags: ,

This blog is multi language by p.osting.it's Babel