Topic: Routing problem
New to ruby here, I use windows 7 and using rails installer.
Currently I just learning from podcast, and I encounter this problem.
At first, I create a controller by using
rails generate model Subscriber
and then create a controller by using
rails generate controller Subscribers
and then I modify my controller into
class SubscribersController < ApplicationController
def create
if request.post?
@subscriber = Subscriber.new(:email => params[:email])
if @subscriber.save
@success = "Thank you, You have been subsribed."
else
@error = @subscriber.errors.full_messages[0]
end
end
endend
and then i create the create.html.erb at the view folder
supposedly according to the tutorial I should be able to access it on localhost:3000/subscribers/create
but I got the following message instead
Routing Error
No route matches "/subscribers/create"
So i tick around and add a litle line into my routes.rb
get "subscribers/create"
and it is showing the page properly, however when I submit the form it's showing the routing error message again.
Anyone know where I did wrong? pretty sure I followed everything step by step that mentioned on the podcast but the result is very different ![]()