ActionController::RoutingError (No route matches "")

ActionController::RoutingError (No route matches "/atweet"):

Unsure on why routing to my view isn't working. controller appears to be functioning, however the view isn't work, when I attempt to go to it, this happens... sniff... sniff.... help???

I don't get routes.rb in rails...

Routes seems hard for the first time, but don't worry, you will do it! :wink:

Usually works like this:

map.connect '/something/:id', :controller => 'nameofcontroller', :action => 'whattodo'

When you press the link, and you get the message what you did, it means you haven't worked out the routing which tells for the Rails app where can find the result. Did you use scaffolding? Or made Rails app from scratch?

It's also important to note: the order of the lines in the routes.rb is important (at least it was important on Rails 2.3.X, I'm not sure about Rails3 in this, haven't checked yet)

Feel free to write me on private if you have further problems with it! good luck gezope

ure on why routing to my view isn't working. controller appears to be

Zoltan Gero wrote:

Routes seems hard for the first time, but don't worry, you will do it! :wink:

Usually works like this:

map.connect '/something/:id', :controller => 'nameofcontroller', :action => 'whattodo'

is that for rails 3? I'm using rails 3. the routes.rb does contain a line to route atweet to the atweet controller. I used the rubyguides.org documentation to write the routes.rb rake routes gives me an error. I made it using rails new project then rails generate controller atweet then rails generate model Soda

I also had questions as to the interaction between controller and model, can I have the controller saving data into the model from inside the controller?

For the record: match 'atweet', :to => 'atweet'

i.e. in rails 3 match 'url', :to => 'controller'

also new problem is: undefined method `action'

NoMethodError in AtweetController#atweet

Still working on it. thanks for the help.

Try changing it to something like this: match 'atweet', :to => 'atweet#index'

This would mean that in AtweetController the index method when you go to /atweet in your browser.

Are you familiar with MVC ? If not, do a bit of googling.

Luke

Luke Cowell wrote:

Try changing it to something like this: match 'atweet', :to => 'atweet#index'

This would mean that in AtweetController the index method when you go to /atweet in your browser.

Are you familiar with MVC ? If not, do a bit of googling.

Luke

yeah I understand #index means it calls the index method in my controller... although there actually wasn't an index method in my controller I had to add one. Anyway, still getting the error undefined method 'action' the controller does fire and queries my sql database, etc. though

i tried adding

def index

my controller's code

end

I also deleted the match :action/:controller/:id in the routes.rb file to simplify things.