ruby on rails - Send notification to pin owner -


i want send notification (actionmailer) owner of pin when user has voted pin. working, did not manage print name of voter in email notification. welcome!

i have following in pin controller:

def   @pin.liked_by current_user   redirect_to :back, notice: 'je hebt dit recept nu toegevoegd aan jouw bewaarde recepten.'   modelmailer.new_like_notification(@pin).deliver   end 

[edit] have following mailer:

def new_like_notification(pin) @pin = pin @user = pin.user mail to: pin.user.email, subject: "#{@pin.user.name}, jouw recept #{@pin.description} wordt lekker gevonden door anderen.", bcc: "oliviervanhees@gmail.com" end 

[edit] , have created part in view show voter of pin:

<% @pin.votes_for.voters.each |p| %> <li><%= p.name %></li> <% end %> 

so last part gives following error nomethoderror in pins#like

define @user pin.user in mailer or refer @pin.user in view.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -