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

List<T>().Add problem C# -

Javascript natural sort array/object and maintain index association -