Skip to content

Instantly share code, notes, and snippets.

@themoxman
Last active January 4, 2016 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save themoxman/8651761 to your computer and use it in GitHub Desktop.
Save themoxman/8651761 to your computer and use it in GitHub Desktop.

####Form submits to TagsController#destroy

Whenever I add the Foundation button-group to my form, the 'Save Changes' submit button requests TagsController#destroy instead of #update.

= simple_form_for @tag do |f|
  = f.input :name, label: false
  = f.button :submit, "Save Changes", class: 'button'
= link_to 'Back to Tags', tags_path, class: 'button'
= button_to 'Delete Tag', tag_path(@tag), :method => :delete, data: { confirm: 'Delete Tag?' }, class: 'button'  
= simple_form_for @tag do |f|
  = f.input :name, label: false
  %ul.button-group
    %li= f.button :submit, "Save Changes", class: 'button'
    %li= link_to 'Back to Tags', tags_path, class: 'button'
    %li= button_to 'Delete Tag', tag_path(@tag), :method => :delete, data: { confirm: 'Delete Tag?' }, class: 'button'

####How do forms determine which action to submit to?

How does rails form_for or simple_form_for determine which controller action to submit the form to?

####Thoughts on my implementation of NotesController#create

####No Route Error

Sometimes when I search for notes, click 'edit' on a note listing and then click back, I get a routing error. See screenshot. Seems pretty random though. Doesn't happen every time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment