My Rails application also contains classes which are independent from
the Rails framework, in that they could be reused unchanged if I would,
for example, created a non-web-based, command-line version of my app.
Such a class could be one which implements business logic, or a simple
utility class.
The question is: What is a good practice of integrating it?
In a "non-Rails" application, I would create a directory app/lib and put
the rb files there. I would ensure, that RUBYLIB points to this
directory, and I would do a "require" in those files where the classes
are needed.
This should also work within Rails. However, is this good practice? How
are experienced Rails developers handle this?
Note also, that these classes will be instantiated only inside a
controller, not in a view or model.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/852ced0ac40d6daa71fcd39d6e62cbd2%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment