On Wednesday, 18 June 2014 06:31:03 UTC-5, Ruby-Forum.com User wrote:
>
> I have nested resources
>
> resources :dicts do
> resources :cards
> end
>
> and in my form
>
> form_for [@dict,@card] do |f|
>
> I have the following button:
>
> <%= f.submit('LIST ALL', url: dict_cards_path(@dict.id),
> class:'kanren_button', name:'list_all', method: :get) %>
>
> The generated HTML code is:
>
> <input class="kanren_button" method="get" name="back_to_list"
> type="submit" url="/dicts/6/cards" value="BACK TO LIST" />
>
>
URL + method are properties of the "form" tag, not of the submit button.
This will not work.
A better question: what is this button supposed to *do*? It appears to be
on a form that's *editing* a particular card...
--Matt Jones
> I would expect that clicking this button would call Card.index, but I
> get instead the error message
>
> The action 'update' could not be found for CardsController
>
> It is correct that I don't have a CardsController.update yet, but I
> don't think I should need one at this point.
>
> The output from 'rake routes|grep card' looks fine for me:
>
> dict_cards GET /dicts/:dict_id/cards(.:format)
> cards#index
> POST /dicts/:dict_id/cards(.:format)
> cards#create
> new_dict_card GET /dicts/:dict_id/cards/new(.:format) cards#new
> edit_dict_card GET /dicts/:dict_id/cards/:id/edit(.:format)
> cards#edit
> dict_card GET /dicts/:dict_id/cards/:id(.:format)
> cards#show
> PATCH /dicts/:dict_id/cards/:id(.:format)
> cards#update
> PUT /dicts/:dict_id/cards/:id(.:format)
> cards#update
> DELETE /dicts/:dict_id/cards/:id(.:format)
> cards#destroy
>
> What did I do wrong?
>
> --
> Posted via http://www.ruby-forum.com/.
>
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/f6a37ad9-8527-41ae-8fc2-0450cdc23e00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.