Skip to content

Instantly share code, notes, and snippets.

@johnnymo87
Last active December 21, 2015 08:18
Show Gist options
  • Save johnnymo87/6277078 to your computer and use it in GitHub Desktop.
Save johnnymo87/6277078 to your computer and use it in GitHub Desktop.
I must have something wrong either with my erb or my route, because I'm getting this crazy suffix on my URI when I press my Merge button. From what I can tell, this suffix is an array with the date the article was created and it's permalink, and I have no idea how it got it there instead of the id.
# in /admin/content
# code excluded
<h3><%= _("Merge Articles")%></h3>
<%= form_tag merge_articles_path(@article) do %>
<%= text_field_tag :sender_id, nil, :placeholder => 'Article ID' %>
<%= submit_tag 'Merge' %>
<% end %>
# code excluded
# Admin/XController
%w{advanced cache categories comments content profiles feedback general pages
resources sidebar textfilters themes trackbacks users settings tags redirects seo post_types }.each do |i|
match "/admin/#{i}", :to => "admin/#{i}#index", :format => false
match "/admin/#{i}(/:action(/:id))", :to => "admin/#{i}", :action => nil, :id => nil, :format => false
end
# My route
match '/admin/content/merge_articles/:id', to: 'admin/content#merge_articles', as: 'merge_articles'
/admin/content/merge_articles/[2013, "08", "18", "merge-into-me"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment