From: Bill Mccarthy Date: 2009-12-04T06:18:18+09:00 Subject: Re: System function using variables from fieldset Rick: Thank you for the reply. I really appreciate your input. If you were FORCED to do it this way, what would the syntax be in this case for this system statement to create the directory. Thank you so much again, Bill Rick Denatale wrote: > On Thu, Dec 3, 2009 at 2:34 PM, Bill Mccarthy > wrote: >> <%= f.label :name %> >> >> Ruby. �I am sure that it is easy for one of you. >> >> If someone would be nice enough to get me started in the right >> direction, I would really appreciate it. > > First, I'm guessing that you are trying to write a Rails app, in which > case you should ask on the rails list. > http://groups.google.com/group/rubyonrails-talk > > Second, creating a directory isn't something you really want to do in > a view because: > > 1) The code in the view gets executed before the form is sent to > the user's browser, it's actually generating the html for the form. > so the user hasn't entered anything into the name field yet. > > 2) view's should have very little logic. > > You would create the directory as a response to the user posting the > form, typically in a create or update action in the controller, and > usually indirectly as a result of calling a method on a model object. > > While it's common practice to mix all the view controller and model > stuff up in PHP, it's not good practice, and good PHP code like > mediawiki doesn't do this but I've seen too much PHP code which does. > One of the good things about web frameworks like Rails is that it > encourages a structure which is maintainable. > > Also just where you create the directory is going to depend on how you > deploy the application, in Rails applications you want to typically do > that under RAILS_ROOT probably in the public/files subdirectory, but > again the rails group is the right place to find folks who can talk > you through things like that. > -- > Rick DeNatale > > Blog: http://talklikeaduck.denhaven2.com/ > Twitter: http://twitter.com/RickDeNatale > WWR: http://www.workingwithrails.com/person/9021-rick-denatale > LinkedIn: http://www.linkedin.com/in/rickdenatale -- Posted via http://www.ruby-forum.com/.