Rails: Mailer view with a different name from its action

498 Views Asked by At

I want to find the action mailer corresponding to a specific mailer view. It seems that there are no mailer action with the name of the mailer view's name. How can I find the mailer action in this case?

p.s I am working on Rails code not written by me.

3

There are 3 best solutions below

0
blu On BEST ANSWER

There was a mailer action (with different name from the view), which rendered the view. The action didn't used the view's name explicitly when sending arguments to render function. The action received the view's name as a parameter, and then sent the parameter as an argument to the render function. The parameters to the action were sent from a model. This is why I couldn't find the view's name inside the mailer folder

11
puneet18 On

check mailers folder first then find the mailer class like:

class UserMailer < ActionMailer::Base
...

end

then views are in /views/user_mailer folder

2
Rokibul Hasan On

You can search with the file name exclude the extension, like if you have an view file name order.html.erb you should search with order in app/mailers directory.

For example I have an invoice mailer as following in app/mailers directory

class InvoiceMailer < ActionMailer::Base
    def order
        #.... 
    end
end

and I have an order.html.erb corresponding view file in in app/views/invoice_mailer directory for order mailer.