actionmailer - How do you use an instance variable with mailer in Ruby on Rails? -


i created instance variable (@user) in model of mailer , want access in view? it's giving me an error (@user = nil). what's best way pass variable view (the email body)?

thanks, chirag

if want access instance variable in mailer template in mailer model add

@body[:user] = user_object 

the above create instance variable @user can accessed in view. should able access user object in mailer view doing

@user 

the docs here have examples of alternative ways if using multiple formats (text/html).


Comments

Popular posts from this blog

unicode - Are email addresses allowed to contain non-alphanumeric characters? -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c++ - Convert big endian to little endian when reading from a binary file -