I'm implementing a feature that allows Publify to merge two articles. On the admin page I created the following form (I'm not sure this is correct for what I'm after), which ultimately should allow one to input another article's ID and merge it with the current article being viewed (comments should be preserved but should only have one author).
This form should only be viewable by admins, but I haven't implemented this logic yet.
<%= form_tag({:controller => "admin/content", :action => "merge"}, :method => "put", :class => 'article') do %>
<%= label_tag(:merge_with, "Article ID") %>
<%= text_field_tag(:merge_with) %>
<%= submit_tag("Merge") %>
<% end %>
I also created the following method in admin/content_controller.rb
def merge
@current_article = Article.find(params[:id])
#(this variable should grab the article ID from the form) @input_article =
@merged_article = @current_article + @input_article
return @merged_article
end
The problem with this is I'm not sure how to grab the article ID that was inputed from the form and utilize it in my controller.