I'm using rails 4.0.2 framework. I've a picture scaffolding and from the show page of 'picture' I'm struggling to add a simple builtin form to forward this to an email address.
After entering an email and clicking on the 'forward' button it should send a current picture link in an email. But I'm struggling to achieve this. I created a controller 'forward_picture' with action 'create' and added it as a resource in config/routes file. Then I created a form within picture view as follows.
views/pictures/show.html.erb
...
<%= form_tag(:controller => "forward_picture", :action => "create") do %>
<%= hidden_field_tag :picture_id, params[:@picture.id] %>
<%= label_tag :email %>
<%= text_field_tag :email, params[:email] %>
<%= submit_tag "Forward" %>
<% end %>
Is this the correct way to embed a form, pass parameters and call appropriate action (create) in the forward_picture_controller? How do I use access the parameters in the controller given strong parameter policy in rails 4? In the controller I can construct an appropriate URL to send the given email address.
Any help is appreciated.