Yes. Do an undef before it. Most of the warnings do not come from
rails itself but from some of its libraries (active record, action
pack, etc).
Here''s the full page of warnings I get on starting a server, for
example, with latest rails 1.1.6:
./script/../config/boot.rb:28:Warning: require_gem is obsolete. Use
gem instead.
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/
validations.rb:334: warning: `*'' interpreted as argument prefix
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/
validations.rb:363: warning: `*'' interpreted as argument prefix
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/
migration.rb:224: warning: instance variable @ignore_new_methods not
initialized
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/
migration.rb:224: warning: instance variable @ignore_new_methods not
initialized
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/
connection_adapters/abstract/connection_specification.rb:41: warning:
method redefined; discarding old
allow_concurrency/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/
connection_adapters/sqlserver_adapter.rb:456: warning: method
redefined; discarding old remove_column
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/
connection_adapters/oracle_adapter.rb:119: warning: (...) interpreted
as grouped expression
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/
request.rb:171: warning: method redefined; discarding old
relative_url_root
/usr/lib/ruby/1.8/cgi/session/pstore.rb:17: warning: method redefined;
discarding old
[]/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/
cgi_ext/raw_post_data_fix.rb:57: warning: ambiguous first argument;
put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/
cgi_ext/raw_post_data_fix.rb:8: warning: method redefined; discarding
old initialize_query
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/
session/active_record_store.rb:129: warning: private attribute?
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/
session/active_record_store.rb:179: warning: method redefined;
discarding old connection
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/
prototype_helper.rb:641: warning: ambiguous first argument; put
parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/helpers/
prototype_helper.rb:874: warning: `*'' interpreted as argument prefix
/usr/lib/ruby/gems/1.8/gems/actionmailer-1.2.5/lib/action_mailer/
vendor/tmail/facade.rb:486: warning: method redefined; discarding old
create_reply
/usr/lib/ruby/gems/1.8/gems/actionwebservice-1.1.6/lib/
action_web_service/protocol/xmlrpc_protocol.rb:6: warning: discarding
old message
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/initializer.rb:581:
warning: method redefined; discarding old
[]/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/initializer.rb:590:
warning: method redefined; discarding old []
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/initializer.rb:595:
warning: method redefined; discarding old keys
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/initializer.rb:600:
warning: method redefined; discarding old find_pair
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/initializer.rb:607:
warning: method redefined; discarding old
[]/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/initializer.rb:611:
warning: method redefined; discarding old []
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/initializer.rb:615:
warning: method redefined; discarding old method_missing
=> Booting WEBrick...
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/initializer.rb:483:
warning: instance variable @after_initialize_block not initialized
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:12:
warning: method redefined; discarding old stdinput
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:16:
warning: method redefined; discarding old env_table
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:20:
warning: method redefined; discarding old initialize
---
The rails command itself suffers from these warnings at least:
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/bin/../lib/rails_generator/
scripts/../options.rb:6: warning: redefine append_features
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/bin/../lib/rails_generator/
scripts/../options.rb:23: warning: method redefined; discarding old
mandatory_options
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/bin/../lib/rails_generator/
scripts/../options.rb:31: warning: method redefined; discarding old
default_options
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/bin/../lib/rails_generator/
scripts/../options.rb:43: warning: method redefined; discarding old
full_options
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/bin/../lib/rails_generator/
scripts/../options.rb:50: warning: method redefined; discarding old
options
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/bin/../lib/rails_generator/
scripts/../options.rb:57: warning: method redefined; discarding old
mandatory_options
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/bin/../lib/rails_generator/
scripts/../options.rb:62: warning: method redefined; discarding old
default_options
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/bin/../lib/rails_generator/
scripts/../options.rb:71: warning: method redefined; discarding old
full_options
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/bin/../lib/rails_generator/
scripts/../options.rb:82: warning: method redefined; discarding old
parse!
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/bin/../lib/rails_generator/
scripts/../options.rb:99: warning: method redefined; discarding old
usage
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/bin/../lib/rails_generator/
scripts/../options.rb:103: warning: method redefined; discarding old
usage_message
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/bin/../lib/rails_generator/
scripts/../options.rb:108: warning: method redefined; discarding old
banner
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/bin/../lib/rails_generator/
scripts/../options.rb:116: warning: method redefined; discarding old
add_options!
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/bin/../lib/rails_generator/
scripts/../options.rb:120: warning: method redefined; discarding old
add_general_options!
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/bin/../lib/rails_generator/
spec.rb:16: warning: instance variable @klass not initialized
----
The problem with getting hundreds of warnings and not doing anything
about them is that they hide what can potentially be a real bug. For
example:
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/
session/active_record_store.rb:129: warning: private attribute?
which is code like:
# Lazy-unmarshal session state.
def data
@data ||self.class.unmarshal(read_attribute(@@data_column_name)) || {}
end
#....
private
attr_writer :data
That''s definitively a bug or at least very suspicious code (an
attr_writer that it is made private after a declaration for it that
was public, for example). I don''t know enough about rails to know
if that effects anything, or to suggest a patch, but it does raise an
eyebrow as a first impression.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---