My Snippets

Reading a local Rails file

begin
	f = File.open("#{RAILS_ROOT}/public/#{@mediaitem.path}","r")
	textcontents = f.read
ensure
	f.close
end
return textcontents

August 31st, 2008 Posted by | ruby | no comments
[]