# Can a "facebook" application be written in RoR?

**URL:** <https://www.ruby-forum.com/t/can-a-facebook-application-be-written-in-ror/147222>\
**Category:** Rails\
**Created:** [August 29, 2008, 3:44pm UTC](https://www.ruby-forum.com/t/can-a-facebook-application-be-written-in-ror/147222 "2008-08-29T15:44:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ewagner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/5fc32e/32.png) [@ewagner](https://www.ruby-forum.com/u/ewagner)\
**Post date:** [August 29, 2008, 3:44pm UTC](https://www.ruby-forum.com/t/can-a-facebook-application-be-written-in-ror/147222/1 "2008-08-29T15:44:02Z")

</div>

(Disclaimer: I am new to RoR, coming from developing in [ASP.NET](http://ASP.NET). I am  
looking to start my next project in an open source environment to 1)  
cut down on the costs of tools and hosting, and 2) to learn something  
new. The runners up for “something new” are RoR and PHP.)

I’ve thumbed through RailsSpace a number of times so I know a  
community site CAN be written in RoR. What I’m more interested in is  
can the home page in say facebook, wherein there are numerous webparts  
doing different things, be written in RoR? From what I’ve seen, and  
what I’ve done using tutorials and books, is that RoR works  
wonderfully for CRUD style pages. One page to view customers, and one  
page to add/edit customers. But can one page be the host of multiple  
views driven by multiple controllers? (Yes, my MVC experience is of  
the newb level too. Sorry in advance.)

---

<div class="post-metadata">

**Author:** ![ewagner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/5fc32e/32.png) [@ewagner](https://www.ruby-forum.com/u/ewagner)\
**Post date:** [August 29, 2008, 4:13pm UTC](https://www.ruby-forum.com/t/can-a-facebook-application-be-written-in-ror/147222/2 "2008-08-29T16:13:57Z")

</div>

Hi,

ewagner wrote:

> But can one page be the host of multiple views driven  
> by multiple controllers?

Yes. You can use a layout that’s a composite of / renders partials for  
a  
set of MVC components.

> (Yes, my MVC experience is of the newb level too.  
> Sorry in advance.)

IME, the only ‘tricky’ part of maintaining the MVC pattern here is the  
approach you use to populate the partials when you display the  
composited  
page. One approach is to have a method in application.rb that grabs the  
content for each of the partials. That gives you an application-wide  
controller method feeding content to an application-wide view. There  
are,  
of course, other approaches and you should feel free to make use of  
whichever is most appropriate to your situation. MVC is a very good  
idea,  
but it’s not something that _has_ to be adhered to in every case.

HTH,  
Bill

---

<div class="post-metadata">

**Author:** ![ewagner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/5fc32e/32.png) [@ewagner](https://www.ruby-forum.com/u/ewagner)\
**Post date:** [August 29, 2008, 4:39pm UTC](https://www.ruby-forum.com/t/can-a-facebook-application-be-written-in-ror/147222/3 "2008-08-29T16:39:11Z")

</div>

I’ve found an interesting discussion of this ‘problem’ with a  
potential approach on  
[http://www.railsdev.ws/blog/3/modular-page-assembly-in-rails/](http://www.railsdev.ws/blog/3/modular-page-assembly-in-rails/)  
Don’t forget to download the 10 page pdf at the top of the article,  
that’s the main part!

I don’t think MVC stands in the way of building the Facebook home  
page. Even in Facebook, there is a main view that takes up most space  
(when you log in that’s the news feed). From there your layout pulls  
in many partials to fill the right column. If you’re very consistent  
in your layout, instead of having to fill in all the content in every  
action of your controller, you do that in your ApplicationController.  
Or in a more complex site with different main layouts, you can  
structure your controllers by namespacing them and put common code in  
the top of the hierarchy.

But if you look at the Facebook site, it’s just the home page that is  
fairly complex because it contains infromation from a lot of different  
models (in RoR terms it seems to be calling many index actions from  
many controllers). But all other pages are very focused on what the  
user actually wants to do and can be easily handled in the simple MVC  
context.

It’s actually quite good to build an application focusing on one main  
view, this gives the user also a sense of focus. An application with 4  
views all of equal importance doesn’t seem right to me (except for the  
iGoogle type of dashboards…).

---

<div class="post-metadata">

**Author:** ![ewagner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/5fc32e/32.png) [@ewagner](https://www.ruby-forum.com/u/ewagner)\
**Post date:** [August 30, 2008, 11:47am UTC](https://www.ruby-forum.com/t/can-a-facebook-application-be-written-in-ror/147222/4 "2008-08-30T11:47:27Z")

</div>

Two resources that might help you with it are published and to be  
published by PeepCode and Pragmatic Programmers respectively. Here  
are the links:

1. Peepcode: - You will see that they have published a Rails on  
Facebook PDF. I haven’t had the time to look at it yet so I don’t  
know how much it will help you.  
[http://peepcode.com/](http://peepcode.com/)
2. Pragmatic Programmers:  
[Pragmatic Bookshelf: By Developers, For Developers](http://www.pragprog.com/titles/mmfacer/developing-facebook-platform-applications-with-rails)  
This book is about to be released.  
You may find these two resources helpful.  
Bharat

---

<div class="post-metadata">

**Author:** ![ewagner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/5fc32e/32.png) [@ewagner](https://www.ruby-forum.com/u/ewagner)\
**Post date:** [August 30, 2008, 2:16pm UTC](https://www.ruby-forum.com/t/can-a-facebook-application-be-written-in-ror/147222/5 "2008-08-30T14:16:02Z")

</div>

Thanks everyone! The article deegee posted seems to go over what I’ve  
been looking for, a 3 column layout that can be filled from different  
sources. And the Rails on Facebook has given me some ideas as well.

Thank you!
