Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple app - problems w/ routes

Status
Not open for further replies.

clemcrock

Programmer
Dec 17, 2006
63
US
Hello,


I'm trying to get the backbone of a rails project up and running on localhost and also on a rails playground hosted site.

On localhost the app runs great and I can call my say/hello w/ either: or
but when I try this on my rails playground site I get this when I call the say/hello like this:
ActionView::MissingTemplate (Missing template say/hello.html.erb in view path /home/c73mr0ck/railsapp/app/views):
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.1/lib/action_view/template.rb:85:in `raise_missing_template_exception'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.1/lib/action_view/template.rb:78:in `set_extension_and_file_name'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.1/lib/action_view/template.rb:15:in `initialize'

And I get this when I call the say/hello like this:
ActionController::RoutingError (No route matches "/controller/say/hello" with {:method=>:get}):
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.1/lib/action_controller/routing/recognition_optimisation.rb:67:in `recognize_path'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.1/lib/action_controller/routing/route_set.rb:384:in `recognize'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.1/lib/action_controller/dispatcher.rb:148:in `handle_request'
ect.


My controller code looks like this

Code:
class SayController < ApplicationController
  def hello
  end
end

And my routes.rb code looks like this:
Code:
ActionController::Routing::Routes.draw do |map|
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
end

One thing that could be causing a big problem is that on localhost, my rails version is: Rails 1.2.6

and on the Rails Playground hosting the version is: Rails 2.1.1

Any ideas how I can get this to work in both places?

Thanks,
Clem
 
Alright, so ...
MissingTemplate (Missing template say/hello.html.erb in view path /home/c73mr0ck/railsapp/app/views)

What's in your railsapp/app/views ? Do you have a hello.html.erb in there?

Tao Te Ching Discussions : Chapter 9 (includes links to previous chapters)
What is the nature of conflict?
 
I have a hello.rhtml view in there.

What in tarnations is a .erb file?
 
Now after a bit of tech support I now get this when I go to:
Code:
Code:
Expected /home/c73mr0ck/railsapp/app/controllers/say_controller.rb to define SayController
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:249:in `load_missing_constant'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:452:in `const_missing'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:464:in `const_missing'

and I get this when I go to:

Code:
no route found to match "/controller/say/hello" with {:method=>:get}
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/routing.rb:1325:in `recognize_path'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/routing.rb:1315:in `recognize'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/dispatcher.rb:40:in `dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/fcgi_handler.rb:168:in `process_request'

It all seemed so simple at first....
Edit/Delete Message
 
.erb : embedded ruby

the say_controller.rb should have something like :
Code:
class SayControler < ApplicationController
end
in it.. Does it?

Tao Te Ching Discussions : Chapter 9 (includes links to previous chapters)
What is the nature of conflict?
 
This is my SayController code:

Code:
class SayController < ApplicationController
  def hello
  end
end
 
*hits head against the wall*
I read your first post 12 times before the last two lines came into focus..

One thing that could be causing a big problem is that on localhost, my rails version is: Rails 1.2.6
and on the Rails Playground hosting the version is: Rails 2.1.1

Please, do upgrade to 2.1.1 on your localhost. The differences are huge. The 'SayController' looks familiar from a tutorial so it probably won't be too much work to start over.. But make sure you're reading a 2.0 / 2.1 tutorial.

Tao Te Ching Discussions : Chapter 9 (includes links to previous chapters)
What is the nature of conflict?
 
In both my local and remote environment.rb file I have the rails version set as this:

RAILS_GEM_VERSION = '1.2.6'


Unfortunately, for our main work project, we are running our app on a 1.2.6 rails version so it's safer to run all other apps on this version as well on localhost.

I was under the assumption that if I specified this
RAILS_GEM_VERSION = '1.2.6' in my environment.rb it would force my app to run as rails 1.2.6?
 
See if you can kill all the ruby that was started on your production environment as the wrong version of rails..
And then maybe, apply rails freeze_gems or rails freeze_edge (I don't know enough to tell you which one would be appropriate).

Tao Te Ching Discussions : Chapter 9 (includes links to previous chapters)
What is the nature of conflict?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top