Results 1 to 1 of 1
Thread: Ruby/Rails FAQ
Jul 26, 2006, 07:45 #1
- Join Date
- Jul 2004
- 0 Post(s)
- 0 Thread(s)
I've seen several questions pop up recently that are answered by the same things over and over again. So I'm going to use this thread to post some of my common answers, so I can at the least just link here instead of repeat myself.
Q: How come in Ruby I can't use Fixnum.(months|days|weeks).ago (or other method that works perfectly in Rails)?
A: Rails adds several extensions to normal Ruby classes. This is perfectly acceptable and normal in many cases. To gain access to some of those methods you can try adding the collowing code to your script
require 'rubygems' require_gem 'activesupport'
A: Rails uses a Shared Nothing architecture, much like PHP or any other CGI web scripts. This means that the entire interpreter and application environment is created and destroyed on each request. This obviously creates some overhead, but allows for a lot of potential routes to scale the application. The side effect of this is that unlike Java Servlets, none of your objects exist from one request to the next. To work around this the Session is created as a place to store semi-persistent data on a per-user basis. This data is persisted at the end of each request usually to disk.
(Feel free to add questions and answers to this thread, as they come up. I know that I will.)