I have a controller named RegistriesController. It contains a single
method:
def edit
@jolts_registry = JoltsRegistry.new
end
This runs, and the associated view is invoked. That stops on line 9:
<%= form_for @jolts_registry do |f| %>
The message is:
undefined method `jolts_registries_path' for
#<#<Class:0x184fdd4>:0x1cf7aa0>
What does that mean?
I have a controller named RegistriesController. It contains a single
method:
def edit
@jolts_registry = JoltsRegistry.new
end
This runs, and the associated view is invoked. That stops on line 9:
<%= form_for @jolts_registry do |f| %>
The message is:
undefined method `jolts_registries_path' for
#<#<Class:0x184fdd4>:0x1cf7aa0>
It means you haven't set up a route for it in routes.rb, but you're using one of the route helpers in your view anyway. But have you inspected what this named class is? Is it an instance of your JoltsRegistry model, or maybe nil?
Walter
Have you put an entry for jolts_registries in routes.rb? Probably
something like
resources :jolts_registries
form_for needs the route to generate the form tag.
Colin
I have a controller named RegistriesController. It contains a single
method:
def edit
@jolts_registry = JoltsRegistry.new
end
This runs, and the associated view is invoked. That stops on line 9:
<%= form_for @jolts_registry do |f| %>
The message is:
undefined method `jolts_registries_path' for
#<#<Class:0x184fdd4>:0x1cf7aa0>
What does that mean?
Have you put an entry for jolts_registries in routes.rb? Probably
something like
resources :jolts_registries
I have
match '/registries' => 'registries#edit;
It clearly finds the route, otherwise it wouldn't run the edit method
in registries_controller.
form_for needs the route to generate the form tag.
Don't understand, which route?
I have a controller named RegistriesController. It contains a single
method:
def edit
@jolts_registry = JoltsRegistry.new
end
This runs, and the associated view is invoked. That stops on line 9:
<%= form_for @jolts_registry do |f| %>
The message is:
undefined method `jolts_registries_path' for
#<#<Class:0x184fdd4>:0x1cf7aa0>
What does that mean?
Have you put an entry for jolts_registries in routes.rb? Probably
something like
resources :jolts_registries
I have
match '/registries' => 'registries#edit;
It clearly finds the route, otherwise it wouldn't run the edit method
in registries_controller.
It is not that route that is the problem
form_for needs the route to generate the form tag.
Don't understand, which route?
You are trying to create a form for a JoltRegistry, that expects to
submit to a jolts_registries_path (as in the error message). The
normal way to generate the route would be to use
resources :jolts_registries
Have a look at the Rails Guide on Routing if you don't know what that does.
Colin
I've done that. Same message. I've tried several different
permutations of methods, etc. Always the exact same message. I have no
clue in the world what in the hell it wants me to do. I have no clue
where it gets "jolts_registries" from in the first place.
In your first post you had
@jolts_registry = JoltsRegistry.new
so @jolts_registry is of JoltsRegistry and hence the route it is looking for.
Did you restart the server after changing routes.rb? That is one of
the few times it is necessary to restart it.
If it is still not working post your routes.rb file, the output from
rake routes
and copy and paste the error message and the section of code it relates to.
Did you read and understand the guide on routing?
Colin
Changing the form tag from
<%= form_for @registry do |f| %>
to
<%= form_for @registry, :url => { :action => "create" } do |f| %>
fixed it.
Don't understand, which route?
You are trying to create a form for a JoltRegistry, that expects to
submit to a jolts_registries_path (as in the error message). The
normal way to generate the route would be to use
resources :jolts_registries
I've done that. Same message. I've tried several different
permutations of methods, etc. Always the exact same message. I have no
clue in the world what in the hell it wants me to do. I have no clue
where it gets "jolts_registries" from in the first place.
Changing the form tag from
<%= form_for @registry do |f| %>
It was not that in the first place, according to your post it was
<%= form_for @jolts_registry do |f| %>
Colin
ah..Right. I tried a good many things, kept getting the exact same
error until putting the "action" phrase in. yes I looked at the
routing doc. Didn't see anything to help. Still don't get it.
It would be more helpful for the people if you post your routes.rb here.