On 7 January 2012 19:03, Hassan Schroeder <hassan.schroe...@gmail.com> wrote: > On Sat, Jan 7, 2012 at 10:40 AM, Libber <amarnath.alap...@gmail.com> wrote: >> In my web application, The client has to enter a set of values and I >> want to write them to a text file. This is what I am doing to achieve that. > >> def create >> @s=Sollu.new >> @s.save >> afile=File.open("network.txt",'w') >> afile.write(@s.input) >> afile.close >> redirect_to sollus_path >> end > >> But after I enter the values from the the browser, nothing gets saved in the >> file "network.txt". > > No kidding. Where above do you imagine that `@s.input` is magically > acquiring a value? > > You should run through a basic Rails tutorial on using forms...
Also have a look at the Rails Guide on Debugging. That will show you how to use ruby-debug to break into your code and inspect data and follow the flow. Then you can break in before afile.write(@s.input) and you would see whether @s.input has any content. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.