Now-a-days people are crazy about building Facebook apps. Through this site their app would get more mass attention than normal app. Now I will show how to build facebook app using rails.
1) First your app should needs to register with facebook. Through this link you can register .
2) After your registration you will get app-id, api-key, and secret-key which will be used to identify your app.
3) While registering your app you should give a site URL in web-site tab which tells you where your app is running. In my app, I have given http://127.0.0.1:8080/. As I am hosting my rails app on my local machine which is running on port 8080.
4) In facebook integration tab you should specify canvas page as you like. In my app I have given as http://apps.facebook.com/new_app/. After that you should specify canvas URL and tab URL as same as site URL. Then click on save changes.
Now you are ready with facebook settings is in your hand. Now you need to create rails app.
In rails app I have used facebooker2 gem. Follow this link and set facebooker2 gem for your project. After you configured, run your rails server on port 8080 and access canvas page URL after your signed in facebook. Then see the magic, your app will be rendered inside IFrame of facebook.