No route matches "/subscribers/create"
I copied this from a book I'm reading and I followed all the instructions but it's giving me No route matches "/subscribers/create" erro开发者_高级运维r:
def create
if request.post?
@subscriber = Subscriber.new(:email => params[:email])
if @subscriber.save
@success = "Thank you, You have been subscribed."
else
@error = @subscriber.errors.full_messages[0]
end
end
Please note that the book is written for Rails v2 and I'm using v3.
What's wrong?
The code you posted is missing an END.
Also, no need to specify if request.post?
Rails will automatically route a POST request to the create method
精彩评论