Here is the code entirely:
class SubscriptionsController<ApplicationController
def create
@subscription = Subscription.new(subscription_params)
p params["subscription"]["email"]
@subscription.save
redirect_to root_path
end
private
def subscription_params
params.require(:subscription).permit(:email)
end
end
Views
<%= form_for @subscription do |f| %>
<%= f.text_field :email %>
<%= f.submit "Create", class: 'btn btn-success' %>
<% end %>
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/863be1f3d9ac67631bcbd60984b8616c%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.