I have a User model. If I do:
def my_action
@user = User.new
end
then
<% form_for(@user) do |f| %>
You can also customize restful routes. For example in my application only the index and show actions are appropriate for certain controllers. In my routes.rb file I have some routes like this:
map.resources :announcements, :only => [:index, :show]
You can also use :except
if that's more appropriate.
Since I came here looking for a way to create helpers in routes.rb, here is the way to do it:
get '/users/:id/' =>'users#show', :as => :user
You can map custom routes in your routes.rb file like this...
map.users '/users', :controller => 'user', :action => 'index'
This gives you the users_path
helper you're looking for.