1) Can anyone tell me where to put the common functions, which is to be
used in more than one model & controller? Is there any way to create a
"common_functions.rb" model?
(Or)
is it a good practice to put all the common functions (functions with or
without database activities) in Application controller? since
Application controller is accessible anywhere.
2) How to access Params & session variable in a model?
1) Can anyone tell me where to put the common functions, which is to
be
used in more than one model & controller? Is there any way to create a
"common_functions.rb" model?
You can create modules and include them where appropriate. It may be
appropriate to put some things in application controller - eg all our
controllers require you to be logged in, so the stuff to do with that
is handled at the application controller
(Or)
is it a good practice to put all the common functions (functions
with or
without database activities) in Application controller? since
Application controller is accessible anywhere.
2) How to access Params & session variable in a model?
pass them (or relevant subsets thereof) down as parameters