Skip to content

Cache mailer view#22825

Closed
st0012 wants to merge 22 commits into
rails:masterfrom
st0012:cache-mailer-view
Closed

Cache mailer view#22825
st0012 wants to merge 22 commits into
rails:masterfrom
st0012:cache-mailer-view

Conversation

@st0012

@st0012 st0012 commented Dec 29, 2015

Copy link
Copy Markdown
Contributor

Hi, I'm adding cache feature to ActionMailer's templates. I think there two ways to accomplish this goal.
First is moving all the caching feature from ActionController to AbstractController since both ActionMailer and ActionController are inherited from it.
The second one is porting caching features to ActionMailer, which I think will break the DRY rule.
However, I'm working on this with the second approach. Because I think after I reimplemented it in ActionMailer, I can find some reusable parts in both ActionMailer and ActionController and put them into somewhere like ActiveSupport?
And I know this could be a huge work while I am not every familiar with Rails' codebase. So I am hoping someone can discuss this with me or give me some advice. Any suggestion will be very helpful, thanks!

@rails-bot

Copy link
Copy Markdown

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @arthurnn (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

Comment thread actionmailer/.byebug_history Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this file shouldn't be here

If you think it's usefull -> https://help.github.com/articles/ignoring-files/#create-a-global-gitignore

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tadeusrox Thanks!

@st0012

st0012 commented Dec 29, 2015

Copy link
Copy Markdown
Contributor Author

And I think the main difference between ActionController and ActionMailer's caching implementation is how the cache key is generated and ActionMailer doesn't need to deal with requests.

@rafaelfranca

Copy link
Copy Markdown
Member

I can find some reusable parts in both ActionMailer and ActionController and put them into somewhere like ActiveSupport?

Yes. You can put in Action Dispatch like Abstract Controller already is.

@st0012

st0012 commented Dec 30, 2015

Copy link
Copy Markdown
Contributor Author

Hi, I'm wondering if I need to copy all the caching test from ActionController, and change them to the ActionMailer version? I think most of them are testing the fragment cache itself, not testing fragment cache in ActionController. So make a copy of them in ActionMailer are basically unnecessary. What do you think? cc @rafaelfranca @arthurnn

@st0012 st0012 changed the title [WIP] Cache mailer view Cache mailer view Dec 31, 2015
@st0012

st0012 commented Jan 6, 2016

Copy link
Copy Markdown
Contributor Author

@arthurnn Hi, can you please give me some advice? thank you 😄

@rafaelfranca

Copy link
Copy Markdown
Member

Hi, I'm wondering if I need to copy all the caching test from ActionController, and change them to the ActionMailer version? I think most of them are testing the fragment cache itself, not testing fragment cache in ActionController. So make a copy of them in ActionMailer are basically unnecessary. What do you think?

Yes, agree. It is better to have a fresh start in the test suite, but it is good to use the ActionController tests as inspiration.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need this.

@st0012 st0012 force-pushed the cache-mailer-view branch 2 times, most recently from 2204218 to e5ae5a8 Compare January 7, 2016 07:29
@st0012

st0012 commented Jan 10, 2016

Copy link
Copy Markdown
Contributor Author

Here's what I have done so far:

  1. I move the ActionController::Caching to ActionDispatch::Caching and include it in ActionMailer::Base and ActionController::Caching.
  2. I added some unit tests and functional test to make sure that ActionMailer has the caching ability.
  3. Finally, I changed the environment template files to add ActionMailer's caching configuration.

And I am wondering what I should do next? This is my first time contributing Rails, so I think I need some guide to finish this 😢 .

@rafaelfranca rafaelfranca added this to the 5.0.0 milestone Jan 16, 2016
@dhh dhh assigned rafaelfranca and unassigned arthurnn Feb 10, 2016
@st0012

st0012 commented Feb 20, 2016

Copy link
Copy Markdown
Contributor Author

@rafaelfranca Hello ~ what can I do to merge this?

rafaelfranca added a commit that referenced this pull request Feb 23, 2016
rafaelfranca added a commit that referenced this pull request Feb 24, 2016
@st0012 st0012 deleted the cache-mailer-view branch February 24, 2016 04:07
@st0012

st0012 commented Feb 24, 2016

Copy link
Copy Markdown
Contributor Author

@rafaelfranca Thanks for merging!

@st0012

st0012 commented Feb 24, 2016

Copy link
Copy Markdown
Contributor Author

@rafaelfranca BTW, when should/can I edit the documentations?

@rafaelfranca

Copy link
Copy Markdown
Member

You can open a PR upgrading the documentation, and we really should.

@st0012

st0012 commented Feb 24, 2016

Copy link
Copy Markdown
Contributor Author

@rafaelfranca ok, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants