-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The edit is not working with heroku deployment #5
Comments
Ei @melsatar, Thanks for trying. I didn't test the gem in heroku yet. Only edition fails? Can you provide some error trace? |
The weird thing that, there is no errors and it saves the changes, but when And, i tested to send the mail and it sent the old content not the new. On Mon, May 12, 2014 at 7:57 PM, Marc Anguera Insa <notifications@github.com
Mohamed Sami |
ah! I think this is because: Heroku boots app with production (at least, Probably it's a good idea to add a note in the Readme. And, since allowing arbitrary ruby code evalution ( I implemented this feature with the idea to edit the emails easy in the browser, but just like a feature for development environment. It can be useful in some cases. Any kind of suggestion or idea is welcome 👍 (stars are also welcome 😃). |
So, what the solution, actually I liked the gem and how easy it is, and I implemented it in production environment. So, how can I fix that? Mohamed Sami -----Original Message----- ah! I think this is because: Heroku boots app with production (at least, config.cache_classes = true) environment. In production, code is not reloaded between requests and code is eager-loaded. Since edition feature it's just a file (file system) edition, Rails doesn't take in account this change (without restarting the server). Into the Edit section it's visible because it's a directly File.read(email_template_path) (implementation). |
@melsatar @markets before to try to fix it we should think on what are you doing if you edit these email templates on production environment. If you edit these template in production you are making changes to it outside of your repository, isn't it? IMHO, edit in production environment is not a really good feature. |
I recommend you to disable edition in production (or staging; for environments where eager-load doesn't work). You can achieve this via the initializer (config/initializers/maily.rb): Maily.setup do |config|
...
config.allow_edition = Rails.env.production? ? false : true
...
end |
This feature for administrators only, what do you suggest as alternative? Mohamed Sami -----Original Message----- @melsatar @markets before to try to fix it we should think on what are you doing if you edit these email templates on production environment. If you edit these template in production you are making changes to it outside of your repository, isn't it? |
So, this will make me lose an important feature Mohamed Sami -----Original Message----- I recommend you to disable edition in production (or staging; environments with eager-load don't work for now). You can achieve this via the initializer (config/initializers/maily.rb): |
Also, the gem benefits in editing actually — On Mon, May 12, 2014 at 10:02 PM, Mohamed Sami melsatar@gmail.com wrote:
|
@jrdi yes, all ruby code inside <% %> or <%= %> will be evaluated when rendering the email template, dangerous in production env. To have a full safe edition mode, we would need, for example, a persisted (db) model, and some overrides of Rails (action_mailer) related behavior. I think this is out of Sorry for any inconvenience, but at least for now, I recommend to disable it in production. I'll update docs with some clarifications. I'm totally opened to suggestions or discuss changes (code/docs). |
So, how I can administrator edit the mail and save the template, do you
|
where is the attachment ? |
I mean, send an email with the template changes as an attached file to a pre-configured email addresses (admins or developers). Then this people should download the changes an apply it to app. In that way, developer are able to review the changes (no risk) and deploy it to production. It's just a proposal and I think it could be useful. Button label proposals:
|
So, do you know how to modify your code to make the code saved in database ? Mohamed Sami -----Original Message----- I mean, send an email with the template changes as an attached file to a pre-configured email addresses (admins or developers). Then this people should download the changes an apply it to app. In that way, developer are able to review the changes (no risk) and deploy it to production. |
It implies a very big big change (totally rewrite the gem) and some Rails behaviour overrides. It is out of Of course, you can fork the project and try to implement these changes 👍 (and even send a PR to discuss it).
|
Everything is working fine locally, but in heroku environment does not, do you know why?
The text was updated successfully, but these errors were encountered: