Code Shop http://journlr.com A bit of Ruby, a bit of JavaScript, a bit of love... posterous.com Fri, 28 May 2010 23:55:24 -0700 Setting up JRuby on Rails http://journlr.com/setting-up-jruby-on-rails http://journlr.com/setting-up-jruby-on-rails

I use JRuby a lot more than I use MRI Ruby. I just like the Java VM a lot more. Anyways, to setup a JRuby project you need to do a few different things. Gem install activerecord-jdbc-adapter and one of these based on the database you are going to be using.

1 activerecord-jdbcderby-adapter
2 activerecord-jdbch2-adapter
3 activerecord-jdbchsqldb-adapter
4 activerecord-jdbcmssql-adapter
5 activerecord-jdbcmysql-adapter
6 activerecord-jdbcpostgresql-adapter 
7 activerecord-jdbcsqlite3-adapter

Then run:

1 ./script/generate jdbc

Everything else should be the same.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/68361/photo.jpg http://posterous.com/people/15Zzt2e7kgV Abhi Yerra abhi Abhi Yerra
Mon, 10 May 2010 08:39:46 -0700 Sass 3 and Rails http://journlr.com/sass-3-and-rails http://journlr.com/sass-3-and-rails There is a new version of Sass released today. I was beginning to enjoy using SassScript but apparently there is a new syntax in town: Scss. It's pretty straightforward to convert sass to scss:

sass-convert style.sass style.scss

Also here is a syntax file for Vim hounds.

To compile a sass/scss file to css we need to run the following:
sass --watch plutoz.scss
This will compile the scss/sass file as you work on it. Further, you can watch a whole directory for changes.
sass --watch public/stylesheets

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/68361/photo.jpg http://posterous.com/people/15Zzt2e7kgV Abhi Yerra abhi Abhi Yerra
Thu, 23 Jul 2009 08:23:00 -0700 Upgrading from Rails 1.2.3 to Rails 2.3.3 http://journlr.com/upgrading-from-rails-123-to-rails-233 http://journlr.com/upgrading-from-rails-123-to-rails-233

I was upgrading a Rails 1.2.3 app to Rails 2.3.3 and I thought about documenting what I had to do for future reference. I was following Peter Marklund's article to upgrade to Rails 2.3.2 which I also followed to upgrade. However, I want to cover the many little things that will make your app not work in 2.3.

Upgrading to Rails 2.3.2 should be straightforward.

  1. Modify config/enviornment.rb and change the following: RAILS_GEM_VERSION = '2.3.3' unless defined? RAILS_GEM_VERSION
  2. Delete vendor/rails
  3. Run: rake rails:freeze:edge RELEASE=2.3.3 and rake rails:update. This should place a new version of rails. From here on follow Marklund's article to finish off the rest of the solution.

The main differences between Rails 1.2 and 2 are the many deprecated calls that need to be addressed. Here knowing sed is a godsend. A command like the following

find  app/ -exec sed -i '' 's/A/B/g' {} \; -print

where A is the search and B is the replace works wonders.

Here are some common changes that need to be addressed in transitioning and need to be replaced for your app to work.
s/@request/request/g s/redirect_to_url/redirect_to/g s/find_first/first/g s/find_all/all/g

Also, Rails 1.2 allowed the use of non-Restful urls which I must say are a bitch to fix if they were hardcoded. But that is the state of life...

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/68361/photo.jpg http://posterous.com/people/15Zzt2e7kgV Abhi Yerra abhi Abhi Yerra