Software Development

Thursday, October 15, 2009

can't convert Fixnum into String to_param

I was getting this error in to_param method. I had to explicity call to_s on id to fix it. My to_param method :

def to_param
name_slug ? "#{id.to_s}-#{name_slug.parameterize}" : id.to_s
end

If the name slug is not nil then it uses that to generate the SEO friendly URL otherwise it uses the id.

Saturday, September 19, 2009

-bash: mate:command not found

In Mac OS X 10.5.8 add the line: alias mate='open -a TextMate.app'
to your ~/.bashrc file

Thursday, September 10, 2009

Hivelogic instructions for ruby path

If which ruby shows /usr/bin/ruby instead of /usr/local/bin/ruby , it means you have not set the PATH correctly. I had to add a line: source ~/.profile to the ~/.bash_profile file. Now whenever you bring up the terminal and when you check the PATH, usr/local/bin will come before /usr/bin and the latest installed version will be picked up (which ruby will output /usr/local/bin/ruby)

Monday, August 24, 2009

Syntax to ignore schema.rb file in Subversion

svn propset svn:ignore "schema.rb" db

Monday, August 17, 2009

Scriptaculous Rails - Complex Forms Railscasts IE fix

$($(this).parentNode).remove() works on both FF and IE.

Thursday, August 13, 2009

How to prevent the active_record output in rails console

end the statements with ; nil

Eg: list = Blog.find(:all)
list.each do |x|
puts x.title
end ; nil

Tuesday, July 21, 2009

how to add github to gem repository

gem sources -a http://gems.github.com