Upgraded to 1.2 and my controllers are lost!


#1

Hi,

I upgraded to 1.2 and now my app says the following whenever I go to
one of my controllers:

Expected script/…/config/…/app/controllers/home_controller.rb to
define HomeController

But the first line of home_controller.rb is:

class HomeController < ApplicationController

This happens running under webrick as well as on the production
environment (fastcgi).

$ rails -v
Rails 1.2.1

I did the rake rails:update trick. It only seemed to change my
boot.rb

Thanks,

Mike Vargo


#2

You need to check what plugins you are using. The engines plugin shipped
with 1.2.1 is broken - an update is available. The datebocks_engine is
also broken.

Be aware that Rails load any plugins it finds in the vendor/plugins
directory. You can control what plugins are loaded with the
configure.plugins statement in environment.rb.


#3

Hi Mike, did you update your environment.rb file to use Rails 1.2.1
before performing

rake rails:update

-Conrad


#4

No - I did it afterwards by creating a new Rails project and modding the
generated config files.


#5

Thanks for the help. The note about the engines plugin is scary. Not
sure how to update…

As for Conrads question: Yes. In environment.rb

Specifies gem version of Rails to use when vendor/rails is not

present
RAILS_GEM_VERSION = ‘1.2.1’

the rake rails:update touches the boot.rb file, but that’s about all I
can tell. As for plugins, yes I’m using some:

active_rbac
ajaxscaffoldp
engines
calendar_helper (not really using this right now, but it’s in the
plugins directory)
exception_notification

My webrick seems to be whacked now as well:

$ script/server webrick
=> Booting WEBrick…
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/commands/servers/
webrick.rb:11: warning: already initialized constant OPTIONS
=> Booting Mongrel (use ‘script/server webrick’ to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment…
Exiting
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/commands/servers/
mongrel.rb:15: warning: already initialized constant OPTIONS
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/commands/servers/
mongrel.rb:18: undefined method options' for []:Array (NoMethodError) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:33:ingem_original_require’
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:33:in require' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/ active_support/dependencies.rb:496:inrequire’
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/
active_support/dependencies.rb:343:in new_constants_in' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/ active_support/dependencies.rb:496:inrequire’
from /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/
commands/server.rb:39
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:33:in gem_original_require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:33:inrequire’
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/
active_support/dependencies.rb:496:in require' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/ active_support/dependencies.rb:343:innew_constants_in’
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/
active_support/dependencies.rb:496:in `require’
from script/server:3

I’m crashing and burning. It’s always so hard to go back… I’m glad
I tagged the source tree!

Mike


#6

Hi Mike, do you no if all the plugins that you’re using within you’re
app has been upgraded for rails 1.2.x? If not, then I would highly
recommend the following course of action:

a) downgrade to rails 1.1.6

or

b) resolve the issues in regards to the plugins

Last but not least, could you send me the output of the following:

gem list

Thanks,

-Conrad


#7

Check this post:
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/
efeb1eacdf81a0b5/b1eab53f3986b0c5


#8

Since I only need script.aculo.us, I’m happy to carry on developing with
1.2.1.

Local gems pastied: http://pastie.caboo.se/36667


#9

How can I downgrade?

  1. Change version in environment - seems like a slam dunk
  2. rake rails:update VERSION=1.1.6 (I’m just guessing here)
  3. does gem keep the old version unless I clean up? I think I read
    that somewhere…

Oh, pooh. I hate going backwards. Anybody want to help me out?
Living life on the tips can be fun, but dangerous!

Mike


#10

Assuming you’re still in development, changing the version in
environment.rb should be sufficient.


#11

How can I downgrade?
If you used gems and haven’t removed the old versions, you should be
able to specify the version to use in environment.rb:
RAILS_GEM_VERSION = ‘1.1.6’

You can also checkout version 1.1.6 into /vendor/rails/ and the
application will use that instead. That would be the ideal method if
it’s only one app that is causing you problems.

Steve


#12

Hi,

I’m having some difficulties at working out how I’m supposed
to answer appropriately to XML-requests in my new RESTful
controllers. Especially the suggested behaviour on errors
is of much interest to me.

For example, if an item was not found, I understand that
I should send a 404 error. I’m doing this by something like:
render :text => “Not found”, :status 404

However, I do not really feel comfortable with that. Is
this the best way to throw out HTTP status codes?

Thanks in advance!

Greetings,
Christoph


#13

I too have recently been looking into this while building a REST API.
It
seems there is no standard for error messages. What I’ve done is return
both the HTTP status code as well as a human-readable XML document with
an
explanation of the error in one of the nodes. This is the helper method
I’m
using:

def render_xml_error(status, text = “”)
if text.blank?
case status
when 400
text = “Resource invalid”
when 404
text = “Resource not found”
when 405
text = “Method not allowed”
when 406
text = “Not acceptable”
when 500
text = “Application error”
else “Error”
end
end
render :xml => “#{text}”, :status => status
end

-ed


#14

Just to close this out…

I did change my environment.rb back to 1.1.6 and got it all working.
I learned a bunch in the process as well! Thanks to everybody who
responded. The idea of putting rails into my vendor folder is
attractive for locking down a complete configuration for production.
As of now, I’ll go free with the idea that the RAILS_VERSION thing
will work. When the new engines is out I’ll give the 1.2.1 update
another swing.

Editorial: There are really good people in this group. Thank you
all.

Mike


#15

On Jan 30, 7:28 am, “mvargo” removed_email_address@domain.invalid wrote:

Thanks for the help. The note about theenginesplugin is scary. Not
sure how to update…

Until the engines 1.2 release is official, use this:

rm -fr vendor/plugins/engines
svn co http://svn.rails-engines.org/engines/branches/rb_1.2 vendor/
plugins/engine

Send any feedback to the engines mailing lists or the issue tracking
site - see rails-engines.org for more information. The better the
feedback, the sooner I can make 1.2 official.

  • J *
    ~

#16

Thanks, that makes sense to me. I’ll try something similar. Quite odd
though that there seem to be quite few people bothered with that
problem in general.

Greetings,
Christoph

Ed Hickey schrieb: