I have a bit of a dilemma that I can't figure out a suitable method.
I have an existing system in production (Rails 1.2.6) that I don't want
to modify as I've got lots of modifications in development which will be
merged in a 2 or 3 months.
I am looking for a way to automate a web browser that can access a
couple of reports in the production system and then e-mail them but
access requires an active session because of before filter restrictions
with a rights/roles mechanism.
I've been mucking with lynx text browser and I can sort of get there but
not the entire way and then the output is text instead of the full html.
Anybody doing something like this? Suggestions?
Craig
This is what I'm trying to do...(which of course doesn't work)
require "app/models/personnel.rb"
File.open("test.html, "w") do |file|
@report_name = "Mandatory Requirements Report"
@personnel = Personnel.current_by_dept
file.write "reports/personnels/mandatory_requirements.rhtml"
end
file.close
obviously this requires a web browser but I can't use a web browser (at
least easily) because of the non-standard method of authentication
required to execute the method.
Anyone with suggestions?
Craig
This is what I'm trying to do...(which of course doesn't work)
require "app/models/personnel.rb"
File.open("test.html, "w") do |file|
@report_name = "Mandatory Requirements Report"
@personnel = Personnel.current_by_dept
file.write "reports/personnels/mandatory_requirements.rhtml"
end
file.close
obviously this requires a web browser but I can't use a web browser
(at
least easily) because of the non-standard method of authentication
required to execute the method.
If you're just using model classes why would things like session and
authentication have any impact (you'd need to load more of the rails
framework for it to work though - you'll need to require config/
boot.rb and config/environment.rb (or in a rake task just make your
task depend on :environment.
Fred
hey I had the same problem, look into mechanize for ruby. http://rubyforge.org/projects/mechanize/
Reuben
looks interesting...thanks
Craig