I wasn't thinking about scaling, that's for the tip cwd. I realized looking at this problem today that you are attempting to pass this variable off as an instance variable. Try this:
app/application.rb
class ApplicationController < ActionController::Base
$SERVICE_TYPES = %w{ public commercial }
end
app/test_controller.rbclass TestController < ApplicationController
def index
logger.info "Service Types Equal: " + $SERVICE_TYPES.join(' and ')
end
end
app/views/test/index.rhtml<%= debug $SERVICE_TYPES %>
Produces:
---
- public
- commercial
log/development.log
Processing TestController#index (for 127.0.0.1 at 2006-06-28 09:02:17) [GET]
Session ID: 9bce7eccb192b544c88104867d3adb86
Parameters: {"action"=>"index", "controller"=>"test"}
Service Types Equal: public and commercial
Rendering test/index
So to recap: variables that start with @ are instance variables, variables that do not have a prefix are local variables, variables that start with @@ are class variables, variables that start with $ are global and lastly constants are in ALL_CAPS.
Last edited by Reedy (2006-06-28 10:14:08)
Most code examples are usually pulled out of the air and not tested. Use at your own risk!