Sunday, December 30, 2007

Understanding include and extend in Ruby

I was watching a presentation by Dave Thomas called, "MetaProgramming - Extending Ruby for Fun and Profit", and realized that my understanding of include and extend is mixed up.

My Wrong Understanding
I thought "extend" will add methods from a module into a class as instance methods and "include" will add them as class methods.

Correct Understand:
"extend" adds methods from a module into a class as class methods.
"include" adds methods from a module into a class as instance methods.

It is quite easy to demonstrate this actually.

module SomeModule
def hi
puts "hello"
end
end

class ExtendSample
extend SomeModule
end

ExtendSample.hi

class IncludeSample
include SomeModule
end

IncludeSample.new.hi

Monday, December 17, 2007

AUTO_INCREMENT MySQL

There is a bug in MySQL that reset AUTO_INCREMENT if an index is added and the table is empty. I found a ticket regarding this issue in Ruby on Rails' bug tracker but it won't be fix because it is a MySQL bug.

Anyway, I reset AUTO_INCREMENT to my desire value after adding indexes to the table and that seems to work. Just remember to not add anymore indexes to the table after you set the AUTO_INCREMENT value or else it will be reset again.

Here is how to set the value manually.

execute "ALTER TABLE table1 AUTO_INCREMENT = 100"

Friday, December 14, 2007

added method to help create and drop foreign key

We have a naming convention at my work place for foreign key so I made two methods to help in the creation and dropping of foreign key. I made them because I got tired of typing out the query everytime.

We name our foreign key like this: fk_table_column_reference_table_column. So a foreign key from a "users" table to the "employers" table would look like this. fk_users_employer_id.

This is how you call the method to create a foreign key.


create_foreign_key(:users, :employer_id, :employers, :id)
drop_foreign_key(:users, :employer_id)



def create_foreign_key(table, column, foreign_table, foreign_column)
execute "ALTER TABLE #{table.to_s} ADD CONSTRAINT fk_#{table.to_s}_#{column.to_s} FOREIGN KEY (#{column.to_s}) REFERENCES #{foreign_table}(#{foreign_column})"
end

def drop_foreign_key(table, column)
execute "ALTER TABLE #{table.to_s} DROP FOREIGN KEY fk_#{table.to_s}_#{column.to_s}"
end

Monday, December 10, 2007

NetBeans 6 - Out of Memory Exception

Lately, I have been getting Out of Memory Exception every time NetBeans load up. This is the exception message, "java.lang.OutOfMemoryError: Java heap space". I am using the daily build of the custom ide for Ruby development.

I fixed the problem by setting the max heap size to a 512 MB. This is how I start the ide.

nbrubyide.exe -J-Xmx512m

UPDATE: I just found out that I can set the max heap size in the nbrubyide.conf file. It is in the etc directory under c:\nbrubyide
I modified it to

default_options="-J-Xms24m -J-Xmx256m"

Friday, December 07, 2007

Rails 2.0.1 is out

I am sure this is all over the web but Rails 2.0.1 is out and here is the announcement. I probably won't use it for my current project until after we do a release.

Monday, December 03, 2007

Mongrel installed in wrong location?

I just reinstall my rails stack to use ruby 1.8.6 and mongrel wouldn't start. I kept getting this error instead.

C:/languages/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- C:/languages/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.1-x86-mswin32-60/lib/mongrel/init.rb (MissingSourceFile)

Which is strange since Mongrel is one of the install gem when I do gem list. Here are my install gems.

*** LOCAL GEMS ***

actionmailer (1.3.6)
actionpack (1.13.6)
actionwebservice (1.2.6)
activerecord (1.15.6)
activesupport (1.4.4)
capistrano (2.1.0)
cgi_multipart_eof_fix (2.5.0)
gem_plugin (0.2.3)
highline (1.4.0)
mongrel (1.1.1)
needle (1.3.0)
net-sftp (1.1.0)
net-ssh (1.1.2)
rails (1.2.6)
rake (0.7.3)

I can see mongrel is installed under mongrel-1.1.1-mswin32 but the system was trying to look for mongrel under mongrel-1.1.1-x86-mswin32-60.

I rename my mongrel directory to mongrel-1.1.1-x86-mswin32-60 and everything works. I wonder if I did something wrong or Mongrel just installed in the wrong directory. I am using gem 0.9.5 and it just figures out the correct version of mongrel and install it by itself so I didn't have the chance to pick which version of mongrel I wanted to install.

Tuesday, July 17, 2007

NetBeans IDE 6.0 M10 is out

Netbeans 6.0 M10 is out. There are many editing and debugging improvement for RHTML files. Here is the new feature sections for Ruby development.

  • Find Usages
  • Rename Refactoring
  • RHTML support
    • Debugging (breakpoints, stepping etc. in RHTML files)
    • Code completion
    • Go to declaration
    • Find Usages
    • Rename
  • Improved code completion - attributes, Rails migrations, models and views now include all the expected methods, etc.
  • Enhanced RDoc rendering; embedded Ruby and RHTML code fragments are now syntax highlighted
  • Debugger enhancements (global vars, watch view, locals view)
  • Encoding support (projects now have an encoding property)
  • Basic RSpec and ZenTest support (More Info), basic RJS support
  • JRuby 1.0 is bundled

Developing ROR using Emacs

I saw a few screencast on using Emacs to do ROR development but I was not able to setup emacs to try it out until I saw this five part series on setting up Emacs for Ruby on Rails development from Software bits and pieces.

http://sodonnell.wordpress.com/the-emacs-newbie-guide-for-rails/

After following guide step by steps I was able to get emacs up and running for developing ROR. Initially emacs started up with an error and it wasn't able to go into ROR mode. I found out I was missing inf-ruby which you can get it here. If you following the tutorial then put this file in your c:/emacs-22.1/includes/ directory. After putting the file there, everything works.

I found another site, credmp, also with instructions on how to setup emacs for ROR development. Ruby On Rails and Emacs It also list out the snippets that the emacs-rails supports.

Monday, July 02, 2007

Build FaceBook Application using Rails

Here are links to two blog articles on how to build FaceBook application using Rails.

From GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS:

fist in your facebook

From Liverail >> Rails with currents:

Tutorial on developing a Facebook platform application with Ruby On Rails

Tuesday, June 19, 2007

Where to put the code

That is the question I ask all the time while developing in Rails. Should I put the code in the helper or in the model or in the controller itself. I guess I need to find some advance Rails reading material. On that note, Roby on Rails has a collection of links to making the model fat and the controller skinny. Put Your Controller on a Diet already!

After reading those blog posts, I am seeing myself putting some serious time in slim up my controllers. They are a little on the heavy side for sure.

Tuesday, May 08, 2007

observe_field and radio_button

I had a group of radio buttons that I wanted to trigger some action when one of the button is selected. I setup an observe_field for each radio button but it didn't work. You can't specify observe_field to monitor a group of radio buttons. It would only monitor the first button. Actually, let me clarify that statement. It would work the first time a user click on the button but then subsequence click would not register as something has changed. Apparently, it keeps the last value and when the radio button is selected again, the last value and the current value is the same. That result in a no change. I ended up using onclick with remote_function to trigger the change event.

This is what I had and it doesn't work.
<%= radio_button_tag 'ship_method', 'pickup', :checked => true -%> Pickup

<%= radio_button_tag 'ship_method', 'deliver' -%> Deliver

<%= observe_field 'ship_method_pickup',
:url => { :controller => 'checkout', :action => 'ship_method_select' },
:on => 'click', :with => 'method' -%>

<%= observe_field 'ship_method_deliver',
:url => { :controller => 'checkout', :action => 'ship_method_select' },
:on => 'click', :with => 'method' -%>
This is what I ended up with
<input type="radio" name='ship_method' id='ship_method_pickup'
checked="checked" value="pickup"
onclick="<%=
remote_function(
:url => {:controller => 'checkout', :action => 'ship_method_select', :method => 'pickup'}
)-%>" />

Monday, May 07, 2007

How to pass a class or id to link_to_remote

This does seem like a really simple thing now that I figured out how to do it.
<%= link_to_remote 'Name',
{:url => {:controller => 'some_controller', :action =>'some_action', :id => some_id}},{ :class => 'some_class' }-%>

If you want to specify a fall back url for href instead of the default # you can put that in the html_options part also.
<%= link_to_remote 'Name',
{:url => {:controller => 'some_controller', :action => 'some_action', :id => some_id}},
{:class => 'some_class', :href => url_for({:controller => 'some_controller', :action => 'some_action', :id => some_id}) }-%>

Saturday, May 05, 2007

NetBeans IDE 6.0 M9 is out

I just saw that NetBeans 6 Milestone 9 was released. Go here to see all the changes for M9. There are many new features added for Javascript. You can edit embedded Javascript and CSS inside HTML/JSP. Of course, there are new features for Ruby editing.

Here is the list of changes for Ruby from the site.

  • Advanced code editing: Code completion, Documentation Popup, Semantic highlighting (such as unused local variable coloring), Parameter Hints, Instant Rename, Goto Declaration, Live Code Templates, Mark Occurrences, Reformatting, Pair Matching, Smart Selection, Surround With

  • Project support: Create and run files, run unit tests, run RSpec specifications, jump between files and their testcases, Ruby Gems support, ability to use any version of either JRuby or native Ruby

  • Ruby Debugger, including Rails debugging - run/step, breakpoints, local variables, call stack, thread switching, balloon evaluation, etc. Support for native fast debugging.

  • Ruby On Rails support: Code Generator wizard, Database Migrations, Rake Targets, Support for generator plugins, Jump between Action and View, RHTML highlighting

Download and try it out for yourself.

Sunday, April 01, 2007

NetBeans IDE 6.0 M8 is out

I just installed NetBeans IDE 6.0 M8 and noticed that you can start and stop WEBrick within NetBeans now. Before this release, you would have to kill the java task from the task manager which was a pain. I actually didn't use WEBrick within the ide because of this problem. Instead, I just run it from the command line using the native ruby interpreter instead of jruby.

Before I was able to use the WEBrick instance started by NetBeans, I need to setup the project to use the jdbc adapter for MySQL. Since I didn't really bother reading much instruction, I encountered quite a few problems.

Here are the steps I used to get everything working.

1. Modify environment.rb and add these lines in right before Rails::Initializer:

if RUBY_PLATFORM =~ /java/
require 'rubygems'
RAILS_CONNECTION_ADAPTERS = %w(jdbc)
end

Rails::Initializer.run do |config|

2. Modify database.yml to use the jdbc adapter. Of course, instead of test_development, you put your own database name there.

development:
adapter: jdbc
driver: com.mysql.jdbc.Driver
username: root
password: password
url: jdbc:mysql://localhost:3306/test_development

3. Download the JDBC driver for MySQL.
Download Connector/J 5.0
Unzip or untar the archive and copy mysql-connector-java-5.0.5-bin.jar to your jruby-0.9.8\lib.

You can find your jruby-0.9.8 directory under
C:\Documents and Settings\<your username>\.netbeans\

I found this step to be quite important because adding the driver to CLASSPATH did not work for me.

NetBeans also exposed more rake tasks than before.

Wednesday, March 21, 2007

How to use migration

Yavor Ivanov over at rubycorner.net started a mini series on Rails migration. So far there is one article and I already learned a few things that I didn't know.

How to use Rails Migrations - Part I

I created a table with :created_at column as :null => false but I didn't define the default value so I was having problem with specifying the datetime in my test fixture.

I solved that problem by putting this in my test fixture:
created_at: <%= DateTime.now.strftime('%y-%m-%d %H:%M:%S') %>
What I really should have done is created the column like this.
t.column :created_at, :datetime, :default => Time.now

Tuesday, March 20, 2007

Ruby on Rails Caching

Gregg Pollack over at Rails Envy posted two articles on Ruby on Rails Caching. If you have performance issue, you might want to check them out.

Ruby on Rails Caching Tutorial - Part 1

Ruby on Rails Caching Tutorial - Part 2

Monday, March 19, 2007

Ruby on Rails screencasts

I found this website, Railscasts, that has free Ruby on Rails screencasts. So far, there are 7 screencasts and they are posted pretty regularly.

Friday, March 16, 2007

Acts As State Machine plugin

I just finished reading Bruce Tate article, Crossing borders: Extensions in Rails (The anatomy of an acts_as plug-in), where he mentioned the acts_as_state_machine plugin for Rails. If you ever have model with known transition paths between different states then this plugin will be a great help to you.

Here is an article, The Complete Guide to Rails Plugins: Part 1, on Nuby on Rails showing how to install and create Rails plugin.

And finally, you can go to the acts_as_state_machine plugin's author blog, Acts As State Machine, to see where to download and how to use the plugin.

Here is my example of how to use the plugin to keep track of a light fixture with three state (off, low, and high).

# The Migration class for light
class CreateLights < ActiveRecord::Migration
def self.up
create_table :lights do |t|
t.column :name, :string
t.column :status, :string
end
end

def self.down
drop_table :lights
end
end

# The Model for light

# A simple transition for a light with three states, (off, low, high)
#
# +---------+ switch +---------+ switch +---------+
# | off |-------->| low |-------->| high |
# +---------+ +---------+ +---------+
# ^ |
# |_________________________________________|
#
class Light < ActiveRecord::Base
acts_as_state_machine :initial => :off, :column => 'status'

state :off
state :low
state :high

event :switch do
transitions :from => :off, :to => :low
transitions :from => :low, :to => :high
transitions :from => :high, :to => :off
end
end

-------------------------
Here is a sample run:

>> l = Light.create
=> ...
>> l.current_state
=> :off
>> l.switch!
=> nil
>> l.current_state
=> :low
>> l.switch!
=> nil
>> l.current_state
=> :high
>> l.switch!
=> nil
>> l.current_state
=> :off

Thursday, March 15, 2007

Tips for working with Test Fixtures in Rails

I have a requirement in my migration script that created_at column can not be null.

t.column :created_at, :datetime, :null => false

This cause the Test Fixtures loading to fail. My first attempt to remedy this problem was like this.

created_at: <%= DateTime.now %>

This did not work since the date time format is incorrect. The correct format is year-month-day hour:minute:second.

So, I changed it to

created_at: <%= DateTime.now.strftime('%y-%m-%d %H:%M:%S') %>

and it works.

I don't know if there is a better way to do this but this works for me. Since I went around looking for the solution, I decided to write it down.

Wednesday, March 14, 2007

Validate a number is an integer and within a certain range

Use validates_numericality_of , and validates_inclusion_of to check that a number is an integer and within a certain range.

For example:

You only want to allow people to enter a number between 21 and 30. Here is how you would do it.

validates_numericality_of :n, :only_integer => true, :message => "can only be whole number."
validates_inclusion_of :n, :in => 21..30, :message => "can only be between 21 and 30."

Tuesday, March 13, 2007

Ruby on Rails Quick Reference

I was looking for a way to update my rails application to rails 1.2.3 when I found this guide, Ruby on Rails Quick Reference. It has descriptions to many frequently use rails features.

rake rails:update is how you update your rails application.

Found a cheat sheet with a great deal of information:

Ruby on Rails 1.1 Reference

Drop Derby and goes back to MySql

After my rant yesterday about Derby not supporting column rename, I checked ActiveRecord-JDBC document for Derby and column_rename is not one of the supported feature.

Here is the list of databases and the level of support taken from the document.
  • MySQL - Complete support
  • PostgreSQL - Complete support
  • Oracle - Complete support
  • Microsoft SQL Server - Complete support except for change_column_default
  • DB2 - Complete, except for the migrations:
    • change_column
    • change_column_default
    • remove_column
    • rename_column
    • add_index
    • remove_index
    • rename_table
  • FireBird - Complete, except for change_column_default and rename_column
  • Derby - Complete, except for:
    • change_column
    • change_column_default
    • remove_column
    • rename_column
  • HSQLDB - Complete
Since MySql is completely supported, I switch to using MySql as the database back end for development.

I did notice one little problem with Netbeans today. The "Generate" menu item disappeared from the menu for some reason. I closed and reopened Netbeans but that didn't do anything. Finally, I closed the project, reopen it and the Generate menu item came back. It only happened once. I don't remember what I did to cause the problem though.

Monday, March 12, 2007

Derby does not support renaming column

-- rename_column(:users, :username, :user_name)
rake aborted!
rename_column is not implemented

Opps, I hit another snag when trying to rename username to user_name. Apparently, Derby does not allow renaming of column. I wiped out the database and started over but that is not a practical way to do thing going forward. I think my experiment with Derby is coming in an end here. I wonder why Sun is endorsing a database that is missing such fundamental feature. I don't remember using a database that does not support renaming of column. I guess there is a first for everything.

Now, I regretted that I read, "If You Thought Rails Development Was Fast Before...". I wouldn't have tried Derby without reading that article. It should be renamed to "If You Thought Rails Development Was Fast Before... Here Is How To Slow Yourself Down". I know it is a cheap shot but that article really make me think that I would be more productive using Derby as my development database.

Sunday, March 11, 2007

Using Rails migration with Netbeans 6.0 M7

I hit a temporary road block while following the steps from this article, If You Thought Rails Development Was Fast Before.... I wanted to use migration instead of sql to create the table in the database. After using the generator to create the migration file, I couldn't figure out how to call the db:migrate task in rake. There is no obvious way to call it from Netbeans 6 itself. I look everywhere but I couldn't find anything. I look in jruby-0.9.2 directory and rake is there but there is no bat file to call it. So, I created a bat file to call rake then execute rake db:migrate directly from the command prompt. That did the trick.

Here is the link to a Derby tutorial on how to create a new database in Derby from Netbeans.

Derby Tutorial

Thursday, March 08, 2007

OpenID and Rails

Ruby Inside has a collection of links to discusses and resources on OpenID and Rails. At the bottom, there is a link to Bernie Thompson's screencast and additional OpenId resources.

OpenID for Rails - Bernie Thompson

8 OpenID Resources for Rails Developers - Ruby Inside

Wednesday, March 07, 2007

Rails' validators

Every wonder how to use all those validators (validates_presence_of, validates_uniqueness_of, validates_size_of, validates_acceptance_of, etc..), in Rails? Head over to Juixe TechKnow and read Rails Model Validators. The author has simple samples and explanations for those and a few more.

Monday, March 05, 2007

Screencast of Ruby editing features in Netbeans 6

Roman Strobl, famous for creating screencasts of Matisse GUI Builder in Netbeans 5.0, is at it again. This time he created two screencasts to demonstrate Ruby and Ruby on Rails features in Netbeans 6.

Two Demos: JRuby on Rails and Advanced Ruby Editing in NetBeans

Sunday, March 04, 2007

Ruby Block

If you use Ruby for any thing more than a simple "hello world" program then you probably hit Ruby block and closure. I write a lot of Ruby code to process data files. This is an ideal way to open a text file and process all lines within it.

File.open("filename", "r") do |file|
file.each_line do |line|
# do something with the line
end
end

It automatically close the file when it reached the end of the file.

If you want to learn more about Ruby block then head over to Darwinweb and read Ruby Blocks as Closure.

Friday, March 02, 2007

Great tips for .Net developers moving over to Ruby

Over at Softies on Rails, Jeff Cohen has a great on going series of articles titled, Ruby on Rails for .Net developers. The latest one is on map and collection. I find them quite interesting and helpful. In his example, he has C# codes and the equivalent Ruby codes for us to have a frame of reference when learning to write code in the Ruby way.

I am a .Net developer by day and a Ruby adventurer by night. Although, I am trying to use more and more Ruby code in my day job. I am currently using Ruby for all my scripting needs. Before Ruby, I was using Perl and that was an adventure.

Anyway, if you are a .Net developer and wondering what Ruby is all about then you definitely should check out Softies on Rails.

Netbeans 6 and auto completion

I started to use Netbeans for all my ruby programming tasks and the auto completion is wonderful. Before, I had to search around Ruby Doc for various libraries and methods but now I can just type the class name and press ctrl-space to get all the methods info. I do find one problem with the auto completion though. When I am editing a single file and not a ruby project, I don't get any auto completion help beside the basic variables within the file. I do get the syntax highlighting though. Unfortunately, a lot of my ruby scripts are quick and dirty and do not warrant creating a whole project just to write it. Maybe there is a way to activate the auto completion in single file editing mode. Anyway, beside that little problem, everything is working great so far.

Thursday, March 01, 2007

Articles about Rails Performance on the web

This blog entry, Rails Performance Link Fest, from Juixe TechKnow has a ton of links to various web resources regarding Rail Performances.

NetBeans IDE 6.0 M7

My eternal search for a Ruby editor led me to NetBeans IDE 6.0 M7. It is still in the earlier stage of development but I find its Ruby supports to be pretty good. It has code completion and syntax highlighting. The code completion part is what I like about it. I can't live without code completion.

You can get milestone 7 by going to http://www.netbeans.info/downloads/dev.php and select Q-Build for Build Type. Then download NetBeans IDE 6.0 m7 build 200702191730.

Here is a series of screenshot from Tor Norbye's Weblog

Ruby Screenshot of the Week
Ruby Screenshot of the Week #2
Ruby Screenshot of the Week #3
Ruby Screenshot of the Week #4
Ruby Screenshot of the Week #5

Wednesday, February 28, 2007

Running Mongrel on Windows

Mongrel Win32 HOWTO, from Mongrel shows how to run Mongrel on Windows environment.

Sunday, February 11, 2007

GeoKit

Andre Lewis from Web 2.0 Technologies website has published a new plugin for Rails that does geocoding, location fingers, and distance calculation.

Description from website:
Geokit is a Rails plugin for building location-based apps. It provides geocoding, location finders, and distance calculation in one cohesive package. If you have any tables with latitude/longitude oolumns in your database, or if you every wanted to easily query for "all the stores within a 50 mile radius," then GeoKit is for you.

GeoKit: a plugin for location-based Rails apps
- Web 2.0 Technologies

In-memory and in-database distance calculations -Web 2.0 Technologies

Use Google's smtp server within your Rails application

If you use Google Apps for your domain and has a need to use Google's smtp server to send out email within your Rails application then head over to Depixelate to see how.

Rails and Google Apps / Gmail Integration - Depixelate

Friday, February 09, 2007

begin rescue else end

Jamis Buck points out the not open used "else" clause of the begin end block. Apparently, the begin end clause can have an else in there.

For example:

begin
# Your normal code block
rescue SomeException
# ... handling exception
else
# This part only run if the main code did not throw
# an exception.
ensure
# The very last thing to be run before the clause exit.
# Code in the ensure clause will always get execute.
end

You can read more about this at Jamis Buck blog entry, begin + else.

Ruby compiler for .Net

If you are a .Net developer but want to write Ruby code, this might be something you want to take a look. It compiles Ruby code into .Net binary so you can run it like normal .Net program.

Gardens Point Ruby.NET Compiler

From their website:

"We are pleased to announce the release of a new Beta (version 0.6) of the Gardens Point Ruby.NET compiler. Implementation is not yet complete but we have now implemented the vast majority of Ruby's builtin classes and modules. We have fixed large numbers of existing bugs, but many still remain. We have not yet implemented continuations or Ruby threads but support most other language features.

In addition to passing all 871 tests in the samples/test.rb installation test suite of Ruby 1.8.2, we are now able to support the standard Ruby test unit library and pass most of the 1864 assertions in the test/ruby test directory."

Extending ActionController

Robby Russel from Robby on Rails blog wrote an article on extending the ActionController. Extending the ActionController seems to be quite easy.

Extending ActionController - Roby on Rails

Thursday, February 08, 2007

Intype code editor

For all of those people that want to use TextMate on Windows. This editor might be the answer.

From Intype's website:
"Intype is a powerful and intuitive code editor for Windows with lightning fast response. It is easily extensible and customizable, thanks in part to its support for scripting and native plug-ins. It makes development in any programming or scripting language quick and easy."

Tuesday, February 06, 2007

If you are having problem with the new RubyGems

If you are getting
ERROR: While executing gem … (NoMethodError) undefined  
method `refresh’ for #
lately then here might be a fix to your problem.

In case you're having trouble installing gems

Monday, February 05, 2007

Using Captchator service in Rails

Here is an article, Captchator on Rails, from ERR THE BLOG on how to use the Captchator web service within your Rails application. If for some reason you can't use a local captcha method or don't want to host your own captcha then this might be a good alternative.

Paging in Rails

The author of ERR THE BLOG finds paging in Rails not up to his standard so he wrote his own paging code. He packed it up as a plugin and now we all can enjoy the fruit of his labor. There are some interesting comments to his blog entry that you might want to take a look.

I Will Paginate - ERR THE BLOG

Sunday, February 04, 2007

Hpricot - HTML Parser for Ruby

Hpricot - HTML Parser for Ruby

Active Merchant

Active Merchant is a payment library extracted from Shopify. Here is an article, Processing Credit Cards with Ruby on Rails, on how to use it with Authorize.net payment gateway from OmniNerd.

The list of supported payment gateways from Active Merchant website.

Direct payment gateways:

  • Authorize.net
  • Moneris
  • TrustCommerce
  • LinkPoint
  • Psigate
  • Paypal Payments Pro
  • Eway
  • USA ePay
  • Paypal Payflow Pro (Testing)

Offsite payment gateways:

  • Paypal
  • Chronopay
  • Nochex

Steps to setup Ruby, Rails, and MySQL on MAC OS X

Link to an article with detail instructions for setting up Ruby, Rails, and MySQL on MAC OS X.
Building Ruby, Rails, Subversion, Mongrel, and MySQL on Mac OS X from HIVELOGIC.

Friday, February 02, 2007

Rails deployment help

If you have problems with deploying your rails application, you might want to go to this Google Group's rails-deployment for some help.

Presentations from San Diego ruby users group

sd.rb podcast

The San Diego ruby users group posted various videos of presentations at their meetings on ruby.

RadRails 0.7.2

RadRails is up to version 0.7.2 now.

Piston

Piston

If you use svn:externals to manage plugins for your rails application then this utility will definitely make your life easier. It allows you to keep a copy of the plugin in your local repository and also allows you to update it with the external source.

What is the benefit of having a local copy of the plugin in your repository versus using svn:external? When you do svn update, it will be a lot faster since it doesn't need to go out to external repositories to check for updates.

When you want to sync the plugin with the external source, all you have to do is type:

$piston update vendor/rails

and then

$svn commit --message "sync up plugins with external source"

Life couldn't be easier.