@notice is an object. you need to write each attribute to the file. f.write @notice.title f.write @notice.body f.write @notice.user
On Mar 29, 8:22 pm, Gautam <[email protected]> wrote: > Hello all... > > I am new to rails. > I have a rails app in which i want data from my database table into a > text file. > > I have a notices table that has three fields - title, body and user. I > want this data to be stored in a text or yaml file. > > Here is the code of what I am trying to do... But I am not able to get > it done. > > def save > @notice = Notice.find(params[:id]) > f = File.new("#{RAILS_ROOT}/public/notice.txt","w") > debugger > f.write @notice > f.close > end > > Please help me. -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

