I am trying to create a new record when a user pushes a button. The page seems to be refreshing but no records are being created
%tbody
- page_list.each do |page|
%tr
%td.text-center=image_tag "https://graph.facebook.com/#{page['id']}/picture?width=40&height=40"
%td= link_to page['name'], "http://www.facebook.com/#{page['id']}"
%td= page['category']
%td
%span.webicon.facebook
%td
=link_to 'Import Page', pages_path(:page => { name: page['name'], page_id: page['page_id'] }, :controller => :pages), :class => 'button default tiny'
=link_to 'View Page', "http://www.facebook.com/#{page['id']}", class: 'button default tiny'
Change your link_to
to:
= link_to 'Import Page', pages_path(:page => { name: page['name'], page_id: page['page_id'] }), :class => 'button default tiny', :method => :post
And it's going to work. Links default to use GET
but what you need is a POST
here.