Simple home_url question

A silly as this sounds, I’m not sure how to set the route for the
home_path and home_url helpers. Google has nothing on this. Where do I
define what those paths should resolve to?

Read the comments in the config/route.rb file.

As of Rails 3.0.3, there are no comments in routes.rb that relate to the
creation of home_url and home_path. There is a mention of root:

You can have the root of your site routed with “root”

just remember to delete public/index.html.

root :to => “welcome#index”

but that it all.

I just want to know why in my app, this action:


redirect_to(home_url, :notice => “Completed”)

Returns the following error:


NameError in InvitationsController#complete_thing

undefined local variable or method `home_url’ for
#InvitationsController:0x52ba788

On Sat, May 21, 2011 at 1:53 AM, Taylor S. [email protected]
wrote:


redirect_to(home_url, :notice => “Completed”)

Returns the following error:


NameError in InvitationsController#complete_thing

undefined local variable or method `home_url’ for

have you tried using ‘/’ instead of home_url?

On Sat, May 21, 2011 at 1:53 PM, Taylor S. [email protected]
wrote:

#InvitationsController:0x52ba788

i believe what you want is root_url and not home_url.

also check rake routes and see if you really have a home_path/url
declared.

http://groups.google.com/group/rubyonrails-talk?hl=en.

Hi Alex,

Using ‘/’ works, so thanks for that suggestion. Unfortunately we haven’t
gotten any closer solving the mystery of the missing home_url method.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs