Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7431511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:18:26+00:00 2026-05-29T09:18:26+00:00

In one of my mailer methods I used a variable title ‘@subject’. By default,

  • 0

In one of my mailer methods I used a variable title ‘@subject’. By default, I was expecting this to be present in the corresponding view. However, after wasting quite some time looking around, I realized that the problem was in the variable name. Changing it to anything but @subject worked. Is there a place where these keywords are defined, I google around but didn’t find any such listing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:18:27+00:00Added an answer on May 29, 2026 at 9:18 am

    Hey @Wahaj first of all @subject is not keyword!, you can use reflection to get information about class before using it.
    http://en.wikipedia.org/wiki/Reflection_(computer_programming)#Ruby

    You can get all instance method by object_or_class.instance_methods message or just call object.methods will return available methods, there is lots more google it

    Now when you call action mailer method like

     UserMailer.welcome(params)
    

    it return Mail::Message object https://github.com/rails/rails/blob/master/actionmailer/lib/action_mailer/base.rb#L143

    here is result of Mail::Message reflection

     m=Mail::Message.new => #<Mail::Message:-634435678, Multipart: false, Headers: > 
     m.methods => [....,"subject", "subject=",...]
    

    it seems that subject is attr_accessor in Mail::Message class but it is not, subject getter and setter are setting subject value in a header hash..

    #a part from Mail:Message class 
    #  mail.subject "G'Day mate"
    #  mail.subject #=> "G'Day mate"
    def subject( val = nil )
      default :subject, val
    end
    
    # Sets the Subject value of the mail object, pass in a string of the field
    #
    # Example:
    #
    #  mail.subject = '=?UTF-8?Q?This_is_=E3=81=82_string?='
    #  mail.subject #=> "This is あ string"
    def subject=( val )
      header[:subject] = val
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Swift Mailer to check for bounced messages. I have created one
I currently have three methods which I want to collapse into one: def send_email(contact,email)
How can I send an email in one line without creating a mailer class?
I'm doing the following right now in one of my user mailer views: <%
Is it possible to have a Rails mailer without any view ? When dealing
We are using asp.net 3.5 with c#.We have to make an powerful mailer module.This
I have a user_mailer with a layout. For one of my actionmailer methods I
I'm getting this error message trying to use PHP Mailer. Please let me know
This should be an easy one to track down...but it isn't proving that way
One of those classic programming interview questions... You are given two marbles, and told

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.