开发者

Where does @mime_partial come from?

I have a .rhtml file and there are many condition checks like this <% if @mime_partial %> This condition is used before using html tags.

I'm working on action mailer. I'm redesigning the view, the 开发者_Go百科code is written by my friend. In the browser one can click the button to "send email".

The variable @mime_partial is defined no where. I thought it's an internal thing of Rails.

What is the significance of this mime_partial?

Thanks in advance.

EDIT:

I used grep and got this:

xyz.merge!(:mime_partial => true, .... )

It has never been set to false, then why are they using if condition on it?

Answer:

I found out the answer.

this @mime_partial corresponds to mailer. When I render the view in browser, it will be controlled by controller not mailer, so @mime_partial will be false.

When I render the content by sending email, then in email the @mime_partial will be set to true, because it is controlled by mailer not controller. Then it will render some new contents which were inside the if condition.

thanks for the support.


Most probably your controller is creating this instance variable. You may grep your sources and see where this variable is used.

I don't see this variable in Rails 1.x sources, so I believe it is something specific to your application. But it may be, that this variable is created by some gem or plugin.

cd your/rails_app && grep -r 'mime_partial' .


Without more information about what you exactly are working on it's impossible to guess what that means.

However, the general thing is that you have something like this:

<% if @mime_partial %>
    some stuff here that only gets rendered if @mime_partial is true
<% end %>

In short, if @mime_partial is not set to true, then the stuff inside the if will not be included in the output (page).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜