Is it possible to display the log files in the view? Thanks in advance. -- Posted via http://www.ruby-forum.com/.
Am Dienstag, den 28.02.2006, 21:34 +0100 schrieb Alex MacCaw:> Is it possible to display the log files in the view? > Thanks in advance.Rails views are ERB files and inside you can do anything what is doable with ruby. If you want to display the current log file for example: <%= File.open("#{RAILS_ROOT}/log/#{RAILS_ENV}.log") { |f| f.read } %> -- Norman Timmler http://blog.inlet-media.de
Norman Timmler wrote:> Am Dienstag, den 28.02.2006, 21:34 +0100 schrieb Alex MacCaw: >> Is it possible to display the log files in the view? >> Thanks in advance. > > Rails views are ERB files and inside you can do anything what is doable > with ruby. > > If you want to display the current log file for example: > > <%= File.open("#{RAILS_ROOT}/log/#{RAILS_ENV}.log") { |f| f.read } %> > > -- > Norman Timmler > > http://blog.inlet-media.deThanks, Also what would be the commands to clear the log file? -- Posted via http://www.ruby-forum.com/.
Am Mittwoch, den 01.03.2006, 17:40 +0100 schrieb Alex MacCaw:> Also what would be the commands to clear the log file?File::truncate("#{RAILS_ROOT}/log/#{RAILS_ENV}.log", 0) -- Norman Timmler http://blog.inlet-media.de
Alex MacCaw wrote:> Thanks, > Also what would be the commands to clear the log file?Now: rake clear_logs Rails 1.1 rake logs:clear -- Lee
Lee O''Mara wrote:> Alex MacCaw wrote: > >> Thanks, >> Also what would be the commands to clear the log file? > > Now: > > rake clear_logs > > Rails 1.1 > > rake logs:clear > > -- > LeeCan you run this command inside a controller? -- Posted via http://www.ruby-forum.com/.
Alex MacCaw wrote:> Lee O''Mara wrote: >> Alex MacCaw wrote: >> >>> Thanks, >>> Also what would be the commands to clear the log file? >> Now: >> >> rake clear_logs >> >> Rails 1.1 >> >> rake logs:clear >> > > Can you run this command inside a controller? >No, those are Rake[1]tasks. They are run from the command line. You can list all the available rake tasks for your app with: rake -T. Geoffrey Grosenbach recently wrote up a nice piece about Rake and Rails [2] 1. http://rake.rubyforge.org/ RAKE ? Ruby Make 2. http://nubyonrails.com/articles/2006/02/25/rake-rake-rake-your-boat rake, rake, rake your boat -- Lee