Sorki za spam, ale juz chce dokladnie pokazac jak to u mnie wyglada:
[code]# Be sure to restart your server when you modify this file
Uncomment below to force Rails into production mode when
you don’t control web/app server and can’t set it the proper way
ENV[‘RAILS_ENV’] ||= ‘production’
Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = ‘2.0.2’ unless defined? RAILS_GEM_VERSION
DB_STRING_MAX_LENGTH = 255 #tutaj - dlatego, ze przyda sie nie tylko w modelu Spec
Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(FILE), ‘boot’)
Rails::Initializer.run do |config|
Settings in config/environments/* take precedence over those specified here.
Application configuration should go into files in config/initializers
– all .rb files in that directory are automatically loaded.
See Rails::Configuration for more options.
Skip frameworks you’re not going to use (only works if using vendor/rails).
To use Rails without a database, you must remove the Active Record framework
config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
Only load the plugins named here, in the order given. By default, all plugins
in vendor/plugins are loaded in alphabetical order.
:all can be used as a placeholder for all plugins not explicitly named
config.plugins = [ :exception_notification, :ssl_requirement, :all ]
Add additional load paths for your own custom dirs
config.load_paths += %W( #{RAILS_ROOT}/extras )
Force all environments to use the same logger level
(by default production uses :info, the others :debug)
config.log_level = :debug
Your secret key for verifying cookie session data integrity.
If you change this key, all old sessions will become invalid!
Make sure the secret is at least 30 characters and all random,
no regular words or you’ll be exposed to dictionary attacks.
config.action_controller.session = {
:session_key => ‘_MOTOMANIA_session’,
:secret => ‘09856b552d3027ee2067086ba8b66703908eea0d2afad9c84a5c67a967357741f056b4ae78e00d04c2a8e46c4ad05d428027d95950cfb1968a0051b0c54d9cc6’
}
Use the database for sessions instead of the cookie-based default,
which shouldn’t be used to store highly confidential information
(create the session table with ‘rake db:sessions:create’)
config.action_controller.session_store = :active_record_store
Use SQL instead of Active Record’s schema dumper when creating the test database.
This is necessary if your schema can’t be completely dumped by the schema dumper,
like if you have constraints or database-specific column types
config.active_record.schema_format = :sql
Activate observers that should always be running
config.active_record.observers = :cacher, :garbage_collector
Make Active Record use UTC-base instead of local time
config.active_record.default_timezone = :utc
config.action_mailer.delivery_method = :smtp
end
config.action_mailer.server_settings =
{
:address => ‘smtp.poczta.onet.pl’,
:port => 25,
:domain => ‘onet.pl’,
:authentication => :login,
:user_name => ‘rysic@vp.pl’,
:password => ‘123’
}
require “will_paginate”[/code]
Wtedy wywala:
[code]=> Booting WEBrick…
D:/kamil szkola/ruby/railsspace/MOTOMANIA/config/environment.rb:67: undefined local variable or method `config’ for main:Object (NameError)
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'
from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/webrick.rb:59
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'
from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from script/server:3[/code]
Nie wiem, czy nie powinienem tez ‘config.action_mailer.server_settings’ umiescic w srodku. Czyli:
[code]# Be sure to restart your server when you modify this file
Uncomment below to force Rails into production mode when
you don’t control web/app server and can’t set it the proper way
ENV[‘RAILS_ENV’] ||= ‘production’
Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = ‘2.0.2’ unless defined? RAILS_GEM_VERSION
DB_STRING_MAX_LENGTH = 255 #tutaj - dlatego, ze przyda sie nie tylko w modelu Spec
Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(FILE), ‘boot’)
Rails::Initializer.run do |config|
Settings in config/environments/* take precedence over those specified here.
Application configuration should go into files in config/initializers
– all .rb files in that directory are automatically loaded.
See Rails::Configuration for more options.
Skip frameworks you’re not going to use (only works if using vendor/rails).
To use Rails without a database, you must remove the Active Record framework
config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
Only load the plugins named here, in the order given. By default, all plugins
in vendor/plugins are loaded in alphabetical order.
:all can be used as a placeholder for all plugins not explicitly named
config.plugins = [ :exception_notification, :ssl_requirement, :all ]
Add additional load paths for your own custom dirs
config.load_paths += %W( #{RAILS_ROOT}/extras )
Force all environments to use the same logger level
(by default production uses :info, the others :debug)
config.log_level = :debug
Your secret key for verifying cookie session data integrity.
If you change this key, all old sessions will become invalid!
Make sure the secret is at least 30 characters and all random,
no regular words or you’ll be exposed to dictionary attacks.
config.action_controller.session = {
:session_key => ‘_MOTOMANIA_session’,
:secret => ‘09856b552d3027ee2067086ba8b66703908eea0d2afad9c84a5c67a967357741f056b4ae78e00d04c2a8e46c4ad05d428027d95950cfb1968a0051b0c54d9cc6’
}
Use the database for sessions instead of the cookie-based default,
which shouldn’t be used to store highly confidential information
(create the session table with ‘rake db:sessions:create’)
config.action_controller.session_store = :active_record_store
Use SQL instead of Active Record’s schema dumper when creating the test database.
This is necessary if your schema can’t be completely dumped by the schema dumper,
like if you have constraints or database-specific column types
config.active_record.schema_format = :sql
Activate observers that should always be running
config.active_record.observers = :cacher, :garbage_collector
Make Active Record use UTC-base instead of local time
config.active_record.default_timezone = :utc
config.action_mailer.delivery_method = :smtp
config.action_mailer.server_settings =
{
:address => ‘smtp.poczta.onet.pl’,
:port => 25,
:domain => ‘onet.pl’,
:authentication => :login,
:user_name => ‘rysic@vp.pl’,
:password => ‘123’
}
end
require “will_paginate”[/code]
Jak tak zrobie, to wywala:
[code]=> Booting WEBrick…
c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:354:in method_missing': undefined method
server_settings=’ for ActionMailer::Base:Class (NoMethodError)
from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializer.rb:328:in `send'
from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializer.rb:328:in `initialize_framework_settings'
from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializer.rb:327:in `each'
from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializer.rb:327:in `initialize_framework_settings'
from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializer.rb:324:in `each'
from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializer.rb:324:in `initialize_framework_settings'
from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializer.rb:101:in `process'
from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializer.rb:49:in `send'
... 13 levels...
from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from script/server:3[/code]
Co do tego, ze malo informacji, to NetBeans mi tylko to wyrzuca. Co do copy paste, to macie racje. Musze sie nawrocic
Za szybko bym chcial wszystko zrobic…