2009
02.21

We are using OpenChart2 plugin for ruby on rails published by PullMonkey.com – We have had good experience with it in our projects.

Here is the link: http://pullmonkey.com/projects/open_flash_chart2/

2009
02.21

Here is the documentation to install RMagick on MacOS

http://rmagick.rubyforge.org/install-osx.html

2009
02.08

http://guides.rails.info/getting_started.html

2009
02.07

While working with YUI Editor, We were trying to set the intial value and we wanted to use the setEditorHTML function. Did not work.

We then figured out you need to wait for the event editorContedLoaded event before trying to set the value – SOLVED!!

my_editor = new YAHOO.widget.Editor(”editor_container”, myconfig);

my_editor.render();
my_editor.on(”editorContentLoaded”, function(){
my_editor.setEditorHTML(”My initial value”);
});

2009
02.06

Here is an excellent tutorial as to how to do this  http://railsforum.com/viewtopic.php?id=719

2009
02.05

MySQL: Month Difference (Approximate)

By Satish Natarajan

I know this does not take the difference in days – however in a recent project it was helpful for us. Putting it out there if someone can use it.

SELECT PERIOD_DIFF(DATE_FORMAT(DATE(”2008-08-15″), “%Y%m”), DATE_FORMAT(DATE(”2008-01-31″), “%Y%m”));

2009
02.04

Installing acts_as_tree

ruby script/plugin install http://dev.rubyonrails.org/svn/rails/plugins/acts_as_tree/

Suppose category is the model so the migration would look like this

class CreateCategories < ActiveRecord::Migration
def self.up
create_table :categories do |t|
t.string :name
t.integer :parent_id
t.timestamps
end
end

def self.down
drop_table :categories
end
end

The Model file would look like this

class Category < ActiveRecord::Base

has_many :children, :foreign_key => :parent_id
belongs_to :parent, :foreign_key => :parent_id

acts_as_tree :o rder => “name”
end

The Active Scaffold controller would look like this

class Admin::CategoriesController < ApplicationController

active_scaffold :category do |config|
config.columns = [
:name,
:parent,
:children]
config.list.columns = [:name, :parent, :children]
config.columns[:parent].form_ui = :select
config.columns[:children].association.reverse = :parent
config.columns[:children].includes = []
end
end