jeudi 12 mars 2015

who calls url_for(options=nil), and when?

In ruby 1.9.3 and rails 3.2.6, I built a simplest project:



rails _3.2.6_ new subdomains
rails g scaffold Blog name:string subdomain:string


then, I add a blank function



def url_for(options = nil) {}


into the file app/helper/url_helper.rb


and append a line into app/controller/application_controller.rb



class ApplicationController < ActionController::Base
include UrlHelper
end


After running, when I click the button Create Blog of the page http://localhost:3000/blogs/new, I alway got the error:



No route matches [POST] "/blogs/new"


I don't know who calls this function url_for with parameter :controller => 'blogs', :action => 'new', when?


I know I must miss some basic knowledge about rails, any advice will be appreciated!


Aucun commentaire:

Enregistrer un commentaire