does a ruby on rails rack class get access to the entire rails environment?
- by Andrew Arrow
that is when the
def call(env)
method is invoked by hitting any url, can I inside that method make some ActiveRecord queries, use classes defined in lib, etc. etc.
Or is it more like an irb console without the rails env loaded? Another way to put it with a rake task example:
task :foo => :environment do
# with env
end
task :foo2 do
# without env
end
I would think rack classes would NOT get the environment so they are super fast and don't take all the overhead of a normal rails request.
But that doesn't seem to be the case. I CAN make ActiveRecord queries inside my rack class. So what is the advantage of rack then?