Ruby on Rails guide web sites

1. Gems release, current  version, popularity, bug tracker and for gem wiki link

https://www.ruby-toolbox.com/

2. Ruby language Fundamentals

http://ruby-doc.org/ under it http://docs.ruby-doc.com/docs/ProgrammingRuby/

3. Rails API doc

http://railsapi.com/

4. Get started with rails installation

http://rubyonrails.org/

5. Subversion Git

http://gitref.org/

6.  Live example

http://railsforzombies.org/

7. Online practice Ruby

codepad.org

How to open mobile view on Desktop browsers?

Actually it is very simple

1. Firstly you will have to install Mozilla Firefox browser on you stytem.
2. Install the User Agent AddOn in Firefox and restart Firefox.
3. From Tool Bar of Firefox: Tools >> Default User Agent >> iPhone

Destop firefox user Agent to open mobile view iphone, android on desktop

Destop firefox user Agent

Then this will open the iPhone view of the websites for you in desktop if it exists.
Now, If you want to view the looks of the website for other devices the go to:
Tools >> Default user Agent >> Edit User Agents >> New >> New User Agent

User Agent Firefox

Edit User Agent

and then in
Description : Example iPhone, Android, Tablet etc
User Agent : Paste the following

For iPhone :
Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16

Tablet ios :
Mozilla/5.0 (iPad; CPU OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B141 Safari/8536.25

BlackBerry:
BlackBerry8520/5.0.0.681 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/301

Android 4.04:
Mozilla/5.0 (Linux; U; Android 4.0.4; en-gb; GT-S7562 Build/IMM76I) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

This UserAgent woks fine with Ruby on Rails Project using Mobile_Fu gem for creating different mobile views.

How to freeze my Rails application?, Why I Should freeze my Rails application?

Ruby on Rails allows you to “freeze” the version of Rails used by your application.

1. Following command will freeze your application to the version of Rails that is currently on server:

rake rails:freeze:gems

This command will copy the Rails files to the “vendor/rails” directory of the application. When the Rails application the it will first check for the presence of “vendor/rails” directory. If it exists, Rails will load the Rails components from the directory instead of using the main server copy of Rails.

Unfreezing:

rake rails:unfreeze

Freezing to a different version

This command freezes the application to Rails 2.2.2:

rake rails:freeze:edge RELEASE=2.2.2

Following command freezes Rails to the current development version of your application:

rake rails:freeze:edge

To Find the Rails version of your application using use this command:

script/about

After updating Rails version update your configuration file “config/boot.rb”:

rake rails:update

Ajax call on succes of the previous ajax call?

1st ajax call:


$.ajax({
url:"/your_controller/your_action",
cache:false,
success:function (data) {
check_subs = data; //returned text
if(check=="no"){
alert("This service is not for you.")
}
if(check_subs=="yes"){
var calling_url='http:///subscription/.aspx?entrytype=ACT&entrymode=pack_w&request_attempt=' + random_uuid;
$.ajax({ //2nd ajax call
url:calling_url,
cache:false,
success:function (data) {
alert("Your request for pack is sent ");
console.log(data);
}
});

}
}
});
}
}

Post caling in rails with link_to tag.

Http calling:

<%= link_to “Click to call”, url_for(:action => ‘your_action’, :controller => ‘your_controller’), {:class => ‘html_class’, :method => :post %>

Ajax calling:

<%= link_to “Click to call “, url_for(:action => ‘your_action’, :controller => ‘your_controller’), {:class => ‘html_class’, :method => :post, :remote => true} %>