On 22 August 2012 13:47, Tim Slattery <
Slatt...@bls.gov> wrote:
> Colin Law <
cla...@googlemail.com> wrote:
>
>>On 21 August 2012 21:12, Tim Slattery <
Slatt...@bls.gov> wrote:
>>> 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