"Rails Installation on windows"

Problem : JSON not installable on WINDOWS , when we do bundle install

Solution :

Assuming you have Ruby and Ruby gems installed
> my current platform: ruby-1.8.6. From the command prompt, type:
gem install pik
> After the successful installation of pik, type:
pik_install C:tools
> Add this to your Path Environmental variables (My Computer > Right Click > Properties > Advanced System Settings > Environmental Variables > Path)

Once you’re done. Open a new command prompt and type:
pik list
It will add the current version of ruby into the list.
Now what’s so special about pik? How it can handle the multiple versions? To see that in action, in command prompt, type:
pik install ruby 1.8.7
pik install ruby 1.9.2
Similarly you can do for 1.9.2

pik list
It will show you the current version of ruby and the other ones.

pik use 187
pik use 192

depending on which version to use

ruby -v
now you can have multiple ruby versions on windows also

Time to install Ruby Devkit

Download  – http://rubyinstaller.org/downloads/

Install under C:/devkit

After extraction, open your command, go inside C:devkit prompt and type:
ruby dk.rb init
This will create the config.yml inside C:/devkit. Now you need to define all the Ruby versions inside that file, so that devkit will create native extensions for them. To do that, open that file and at the end of it, write these lines:
– C:ruby
– C:UsersPC-name.pikrubiesRuby-187-p330
– C:UsersPC-name.pikrubiesRuby-192-p0
Once done save it and from the command prompt, type:
ruby dk.rb install

Now you can do
your bundle install
or rails install

and it should work properly

"Rails Installation on windows"

"Rails Installer: Ruby and Rails on Windows in a Single, Easy Install"

RailsInstaller is a new project from Wayne E Seguin (of RVM fame) that brings RubyInstaller-style simplicity to getting Ruby and Rails set up on Microsoft Windows (XP, Vista, or 7). In a single wizard-driven installation you get Ruby 1.8.7-p330 (with DevKit), Rails 3.0.3, Git, and SQLite 3.

Rails Installer was developed with help from Luis Lavena (a Ruby on Windows expert) and Dr. Nic Williams (Engine Yard’s resident Australian comedian) and its release comes just weeks after Wayne was (re)hired by Engine Yard to work on new open source initiatives.

To get started, go to railsinstaller.org, download the “Rails Welcome Kit” and run the installer. There’s a screencast you can watch too. The process is as simple as it sounds and you can have a basic, empty Rails project running within minutes.

If you want to follow along more, check out the @RailsInstaller Twitter account or theRails Installer Google Group / mailing list.

"Rails Installer: Ruby and Rails on Windows in a Single, Easy Install"

"Ruby, Ruby on Rails Support Discontinued in NetBeans IDE"

Dear NetBeans Community: 

After thorough consideration, we have taken the difficult step to discontinue support for Ruby and Ruby on Rails in the NetBeans IDE. Two main issues underpin this decision: 

Java SE 7 and Java Development Kit 7 (JDK 7) are the next major releases of the Java SE platform, which Oracle is committed to deliver in 2011. A key objective of the NetBeans IDE has always been to offer superior support for the Java platform. To maintain that objective and capitalize on the JDK 7 release themes–multi-language support, developer productivity and performance–it is necessary that our engineering resources are committed to a timely and quality release of NetBeans IDE 7.0. 

Second: Although our Ruby support has historically been well received, based on existing low usage trends we are unable to justify the continued allocation of resources to support the feature. 

As of January 27, the Ruby module will be gone from development builds of NetBeans IDE 7.0. Developers who want to continue to use Ruby and Ruby on Rails functionalities in the NetBeans IDE should please visit the NetBeans Ruby Support page for details on how to do so going forward. 

We remain committed to delivering a first-class product to our community of developers and users, and we encourage your feedback on our mailing lists and forums, on Twitter, or by writing to us. 

Thank you for your continued support of NetBeans.
The NetBeans Team

Source : http://netbeans.org/community/news/show/1507.html

"Ruby, Ruby on Rails Support Discontinued in NetBeans IDE"

"csrf token warning fix"

csrf token warning fix

1/ add this to your layout

<%= javascript_tag “var AUTH_TOKEN = #{form_authenticity_token.inspect};” if protect_against_forgery? %>
    <%= csrf_meta_tags %>

Add this to your controller
skip_before_filter :verify_authenticity_token

2/ comment out  protect_from_forgery from your application controller .

"csrf token warning fix"

“Setting up your Ruby on Rails environment for Force.com “

Like many of you, I was excited about the announcement regarding heroku at Dreamforce.  I wanted to learn more about Ruby and heroku and what better way to learn a new programming language than to write and deploy an application.  Though I found the getting started article useful, it assumes you have a working environment.  This article shows you how you can easily setup a working environment on a windows machine. 

The Big Picture

Before we get started, it is useful to understand how the toolkit fits into the overall Ruby environment. Ruby is a programming language  and Rails is a web application framework.  The Force.com toolkit for Ruby is a library (called a gem in Ruby parlance) that speaks to the Force.com database via the Web Services API.  Ruby provides several tools like gem for package management and rake a build program similar to make.  


Setting up the Ruby on Rails environment

The first step is to install Ruby.  I downloaded and installed from  this site – http://rubyinstaller.org/downloads/ .  Run the executable and choose the installation option to add Ruby executable to your path.  I installed it in c:softwareRuby192

Next, open a command window and follow the steps below.  We will be installing various libraries needed to setup our environment.

  •  Install rake.  We will need it later.

    c:softwareRuby192 >  gem install rake

  • Install Rails.  We explicitly specify version 2.3.8 since the toolkit was built against that version.

    c:softwareRuby192 >  gem install -v=2.3.8 rails

  •  Install hpricot as below.  I had to specify the platform flag since I got an error without it.  

    c:softwareRuby192 >  gem install hpricot –platform=mswin32

  • Install Facets.

    c:softwareRuby192 >  gem install -v=2.8.4 facets

  • Install the Force.com Ruby toolkit

    c:softwareRuby192 >  gem install asf-soap-adapter

At this point we have the necessary environment to create a Rails project that uses the Force.com toolkit.  Let us test it by creating a new project and making sure that everything is setup properly.

Testing the toolkit 

We start by creating a new rails project

c:softwareRailsExamples > rails test

This creates a new project under the directory test.  We would need to modify two of the files that rails creates for us.

  • configenvironment.rb – Add the reference to the Force.com toolkit.  Your file should look like this environment.rb file.
  • configdatabase.yml – you need to specify your org credentials.  Add a configuration element called salesforce-default-realm.  The final file should look like this database.yml file.  Do not forget to add the security token to the password element. 

We are now ready to test the connectivity.  Open a command window and go to the root of your project directory.  We will start the console to do our test.

c:softwareRailsExamplestest > ruby scriptconsole

You will now be able to call the different methods in the toolkit.  Let us do a simple query by typing the following in the console.

>> Salesforce::SfBase.query_by_sql(“select name from Account”) 

If everything is setup correctly, you should see a list of the accounts in your org.  

Congrats!  You now have a working environment to start building your Rails applications that leverages Force.com.

What next?

  • Download the example referenced in the wiki article.  You can either download the source or use git a distributed source code control tool.  You can find more information on git and githubhere.
  • Examine the source of the Force.com toolkit – especially sf_base.rb an sf_utility.rb to get an idea of the methods available.  The toolkit is available  here on github.
  • Build your own application and deploy on Heroku.  I will be examining this in a later blog.  

I hope this blog saves you some time as you begin your Ruby journey with Force.com and database.com.  I am excited about the possibilities. Finally, I would like to thank my friend Ray Gao for helping me with some of the issues I ran into while building my first Ruby app.

“Setting up your Ruby on Rails environment for Force.com “

"New Features in Rails 3"

We’re all about following the newest technology in web development. Rails 3 is coming soon, and it promises to be a significant upgrade. With the 4th beta version pushed recently, and a release candidate right around the corner, I thought now would be a good time to go over my two favorite new features.

All New Router

The router has been completely re-written and borrows heavily from the Merb router, but has a more developed DSL.

Regular Routes

Regular routes are more concise, but I’m not sure how I feel about the “controller#action” syntax yet…

<script src=”http://gist.github.com/448079.js?file=gistfile1.builder”></script&gt;

Named Routes

Very similar to regular routes, just with an extra :as variable at the end.

<script src=”http://gist.github.com/448079.js?file=gistfile2.builder”></script&gt;

Restful Routes

I think restful routes get the biggest improvement. The new syntax is MUCH easier to read than in Rails 2.

<script src=”http://gist.github.com/448079.js?file=gistfile3.builder”></script&gt;

ActiveRecord and ActiveRelation

This is probably my favorite addition to Rails. The new ActiveRecord syntax is very similar to Doctrine (which we use with symfony). Instead of passing options as a hash to your find() method, they’ve created a bunch of new methods you can chain together.
<script src=”http://gist.github.com/448079.js?file=gistfile4.builder”></script&gt;

The best part is that any of the query methods just return a relation instead of running the sql query. That way, you can chain more query methods on the relation later. The actual query doesn’t run until you try to access the object(s) (such as with an iterator). This makes fragment caching a lot easier, because you can keep your query call in your action. Even if the cache is hit, it will only create a relation and not actually query the database. You can also force the query to be run at any time by calling all(), first(), or last() on the relation.

"New Features in Rails 3"

“Difference Between Gem and Plugin “

Now a days many developers are developing web application using ruby on rails. But a few of them know what actually the difference between “Gem” and “Plugin”.

Here are some of them


1. Gem is a packaged ruby application using the packaging system defined by RubyGems.

2. Rails itself is a Gem

3. We can install,upgrade and query the gem version.

4. Gem installed for Ruby interpreter can be used system-wide by that interpreter.


1. Plugin is an extension of Rails Framework.

2. Can not be upgraded by using a command. To upgrade one have to uninstall and then install upgraded version.

3. Has to be hooked into rails application. (has to have init.rb)

4. Have an install.rb file.

5. Can only be used application wide.

“Difference Between Gem and Plugin “