Welcome Guest | Login

application.rb versus application_helper.rb

What's the difference between these two files?  I can't find anything in AWDWR, and an online search just turns up people criticizing others for not putting stuff in the right place (although not saying why.)

Any insights?

2007-04-15 09:26 AM

I guess there's aren't many differences in function except for somethings like the before_ and after_filters that can be applied to the application.rb so they are run whenever your app gets hit.  Otherwise defs you put in each can be used by the whole app.

2007-04-15 09:29 AM

Application.rb is your application's base controller. Here you can add common controller behaviors like (as William mentioned) before and after filters. For example, I place my acts_as_authenticated call in application.rb. Application_helper.rb is the file that holds view helper methods common to all your views. For example, I place in here common methods to generate links, etc.

2007-04-17 11:49 AM

Thanks a lot!  That clears it up for me.

2007-04-17 11:53 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up today!