I have the ability to send email to a user if a certain user has
requested interest in their product. In my email I want to include
certain information that is pulled from users but at the moment I am
getting errors because it states that they are undefined despite these
lines being used elsewhere in my application. I shall copy the email
below and anything between the <% %> is what I wish to include and was
wondering if anyone could point me in the right direction and tell me
which are those that are correct and are not. Any help would be
wonderful. The message I want to send is as followed:
The user <% current_user.username %> has registered an interest in the
following product of yours:
<% @book.book_name %>
<% @book.genre %>
The user <% current_user.usernames %> has the following games for offer:
<% current_user.book.book_name %>
To view <% current_user.username %> profile click <% link_to "here",
If you wish to contact the user by email then contact the following
email <% current_user.email %>.
I hope that makes sense. In order to give further insight in to what I
have, I have a users table that includes user information and a book
table that has books information with a user_id foreign key. Users have
a has_many with books and games belongs_to user.
The @user lines work for me but I get undefined method for anything
after @book e.g. undefined method 'book_name'. Why is this so when it
works for user?
Finally I have come to understand that the mailer doesn't recognise
current_user? how would I go about doing the current_user line if that
line is not able to be used?