开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜