Comments (39)
Same for me
from mail_view.
Same here
from mail_view.
Ditto. Would be useful if mail_view's classes/modules weren't cached in non-production environments.
Edit: by that I mean classes that inherit from MailView.
from mail_view.
same here...
from mail_view.
Same here. Kind of defeats the purpose when you're attempting to preview changes during development.
from mail_view.
This is a hassle. Patches welcome to make the middleware respect dev-mode reloading.
from mail_view.
I found this to be frustrating also, but (I think) I'm successfully working around it by adding this to my development.rb:
config.action_view.cache_template_loading = false
When I do that, no server restarts are needed. Of course, I don't want that setting on all the time, so I only use it when testing my email templates. Hope that helps!
from mail_view.
Agree. Absolutely useless without this feature. Somebody let me know if they decide to fork a fix and I'll use that, otherwise, might be tempted to create one myself.
from mail_view.
@damien-roche, you go, girl!
from mail_view.
@dhh, ok, not absolutely useless. But 9 months, and still no fix? Is this project abandoned? I fear you may know the inner workings of Rails a little more intimately than me ;)
from mail_view.
+1
from mail_view.
@adilwali, This solution worked for me thanks!!!
from mail_view.
While I'm on rails 3.2, the way @adilwali suggested, it doesn't work for me.
@jwarzech Which version of rails did you use?
from mail_view.
@millisami I am using rails 3.2.9
from mail_view.
@jwarzech Ok, then I suppose I'll to test it out on 3.2.9 Thanks.
from mail_view.
@millisami I have tested it on Rails 3.2.9
It works
What is your result?
BTW is it possible to make it reload the MailPreview
class without restart?
from mail_view.
@PikachuEXE Did it work for you without adding the config.action_view.cache_template_loading = false
in development.rb
or just installing the gem only?
from mail_view.
@millisami Oh removing that config still works for template
But still not the class (MailPreview
or something)
So this issue is still valid
from mail_view.
So then I guess have to wait on this issue to be fixed or is there any other forks that solved this?
from mail_view.
Is ActionMailer classes supposed to be eager loaded in app and rspec? I forgot
And I cannot find any code related to eager loading...
from mail_view.
Still not fixed, what's the real problem? Should I try to investigate and fix it?
from mail_view.
The problem is that the actions of any subclass of MailView
seem to be preloaded and cached
even on development (with cache config set to false
of course)
So that when you try to add a new action, it does not show up on refresh of index page (e.g./mail_view
)
from mail_view.
@PickachuEXE It can be caused by class constant passed from routes.rb?
from mail_view.
I have no idea how mount
work
So maybe
from mail_view.
@PickachuEXE ok, it's on my todo list now. I'll check later. Same symptoms rails_admin gem has (but it's not a bug, it's kind of expected behavior).
from mail_view.
Great to hear that! Thanks!
P.S. You don't need to mention my name every time
I am watching this thread
from mail_view.
That's OK, since I'm twitter addict 👍
from mail_view.
Here's my cheesy workaround to this issue. Basically, I just route all the requests to the mail view indirectly from a controller. This allows Rails to reload the mail view class.
# routes
match '/mailers/:mailer(/:name)', :to => "mailers#show"
# controller
class MailersController < ApplicationController
def show
request.env.merge!(
'PATH_INFO' => params[:name].to_s,
'SCRIPT_NAME' => url_for(:name => nil)
)
mailer = params[:mailer].classify.constantize
status, headers, body = mailer.call(request.env)
render :text => body.join('').html_safe
end
end
# a mail view
class PreviewMailer < MailView
def some_notification
# do stuff
end
end
Then hit /mailers/preview_mailer to see the list of actions.
from mail_view.
@scharfie It's working! Thanks!
Wonder if this can be included in the gem to solve this bug...
from mail_view.
After using this workaround
I got this bug: Mange/roadie#52
It happens often already before using the workaround
from mail_view.
@scharfie - nice thanks. Does this break .txt email handling, or is that my own slim templates / routing issue?
Make sure it's development only or that's a pretty big security hole.
from mail_view.
In case anyone runs into my problem of it not working with text emails, commenting out the format.html {} in your mailer block will render the text mail instead (since it's the only one then).
from mail_view.
Fixed in rails/rails#10685 🎉
from mail_view.
@trevorturk Wait, is this gem only being maintained as part of the Rails core now?
from mail_view.
@thenickcox, this particular issue turned out to be caused by a Rails bug and was fixed 7 months ago.
I'm not sure about the maintenance plan for this gem. I'd imagine it'll get some fixes but that the bulk of the work will be directed toward the new "inspired by mail_view" feature in Rails (rails/rails#13332)
from mail_view.
How to solve this issue for Rails 5 (Rails 5.1.6 specifically)?
Because solution provided by @adilwali i.e. config.action_view.cache_template_loading = false not working.
from mail_view.
There is email preview in rails now
::ActionMailer::Preview
Try to use that
from mail_view.
@PikachuEXE Yeah I am using ActionMailer::Preview only.
from mail_view.
Then any related issue should be reported to rails repo
from mail_view.
Related Issues (20)
- incompatible character encodings: UTF-8 and ASCII-8BIT HOT 5
- A copy of MailPreview has been removed from the module tree but is still active! HOT 2
- Attachments inserted into preview of text emails HOT 5
- HTML tags in plain text e-mails not escaped
- Changes to I18n.locale are not retained in the email_template HOT 1
- When switching between .txt and .html, <select> should follow HOT 1
- Default format HOT 1
- error installing mail view 2.0.2 HOT 1
- mail_view stopped working with 2.0.3 HOT 2
- How to get it to reload changed mail tempates? HOT 1
- uninitialized constant MailPreview HOT 3
- Rolling Back Database Changes HOT 2
- obsolete as of Rails 4.1? HOT 1
- I have to restart my environment to make mail_preview loading changes HOT 1
- Add License information to Gemspec
- How to use this gem to render Mail object as partial?
- Catch all route prevents previewing in Rails 4.1 HOT 1
- The Iframe's height.
- Email preview in production in rails 4 HOT 2
- README.md: images are broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mail_view.