Hi, I''m looking at the rails cookbook for uploading files[1]. At the bottom of the page it says that the sanitize_filename functioin would probably go in a helper or a library. I wonder where these files would be or what they would be called. Pehaps there are some conventions I need to know about? Thanks, Peter [1] http://manuals.rubyonrails.com/read/chapter/78
On 1/15/06, Peter Michaux <petermichaux@gmail.com> wrote:> Hi, > > I''m looking at the rails cookbook for uploading files[1]. At the > bottom of the page it says that the sanitize_filename functioin would > probably go in a helper or a library. I wonder where these files would > be or what they would be called. Pehaps there are some conventions I > need to know about?Put them into lib. i.e. $ cat lib/helpers.rb module MyHelpers # ... end $ cat config/environment.rb # buncha stuff require_dependency ''helpers''
Thanks Joe. Editing files in the lib directory requires a reboot of webrick? Peter
I think the convention is to place them into helper files in the app/helpers directory. If you name them something like ''#{model}_helper'' they will get included in the controller class and views. Generic helpers can go into the ''application_helper.rb'' file. This does not require a reboot of webrick. _Kevin -- Posted via http://www.ruby-forum.com/.
On 1/15/06, Peter Michaux <petermichaux@gmail.com> wrote:> Thanks Joe. Editing files in the lib directory requires a reboot of webrick?Maybe. I thought that if you include the libraries via ''require_dependency'', webrick wouldn''t need a reboot. But I''m probably wrong.