I am trying to show flash message for one of my methods upon submit, it saves and then displays the flash message but it is not doing that.
class PromotionsController < ApplicationController
def newsletter_signup
@subscriber = Subscriber.new(params[:subscriber])
if params[:subscriber][:email].present?
@subscriber.save
redirect_to :back
flash[:notice] = "Thank you. You have subscribed to our newsletter"
end
end
end
my view in application.html.erb
<div class="row ">
<div class="icon-send col-sm-4 col-lg-4 hidden-xs col-md-4 col-xs-4">
<span class="text-center subscribeLabel">Subscribe to Our Newletter</span>
</div>
<%= form_for(Subscriber.new, url: newsletter_signup_url, :validate => true) do |person_form| %>
<div class="col-md-6 col-sm-6 col-xs-7">
<%= person_form.text_field :email, id: "email", class: "SubscibenowText", placeholder: "Enter Your Email Address" %>
</div>
<div class="col-md-2 col-sm-2 col-xs-5 SubRelative">
<button type="submit" class="pull-right btn btn-default subscribebtn">
GET STARTED
</button>
</div>
<% end %>
</div>
I am not sure what else to do because i have tried different options but all to no avail. I would appreciate any help thanks.