views/ipl_mailer/confirm_doctor_form_submitted_complete.html.slim
p Dear #{#doctor.display_name},
p #{t('.thank_you')}
locales/ipl/en.yml
ipl: &ipl
ipl:
cases_review_forms:
form: &form
would_approve: "Approve(Yes/No)"
edit:
<<: *form
ipl_mailer:
confirm_doctor_form_submitted_complete:
thank_you: 'Thank you for reviewing your ClinCheck treatment plans. We have received your response and noted that all plans are approved.'
I am getting the following error:
I18n.t("thank_you")
"translation missing: en-US.thank_you"
Is it because im doing it in en.yml file instead of en-US.yml
your I18n is trying to find element in yml file inside en-US
yml file should be as below:
en:
ipl: &ipl
ipl_mailer:
confirm_doctor_form_submitted_complete:
thank_you: 'Thank you for'
then you can access it as below:
I18n.t('ipl.ipl_mailer.confirm_doctor_form_submitted_complete.thank_you')
Related
I have a problem with my attachment system on web page. I store them on amazon S3 using paperclip. I have an option to copy attachment to new file. Everything works fine until there are polish special characters in title, like: ŁĄKA.jpg. Then I get an error:
Saving error: Appendix Paperclip::Errors::NotIdentifiedByImageMagickError
/Users/michal/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/validations.rb:79:in `raise_record_invalid'
/Users/michal/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/validations.rb:43:in `save!'
My code:
instance.appendixes.select {|a| a.temporary? && !a.appendix.exists?}.each do |a|
a.appendix = S3File.new(a.s3path)
a.process = false
a.appendix_url = nil
puts "CREATING NEW FILE from (temporary?) appendix: #{a.id}, path: #{a.s3path}, is_public: #{a.is_public}, determine_is_public: #{a.determine_is_public}"
a.is_public = a.determine_is_public
logger.debug("CREATING NEW FILE from (temporary?) appendix: #{a.id}, path: #{a.s3path}, is_public: #{a.is_public}, determine_is_public: #{a.determine_is_public}")
a.save! # bo delayed_job
end
I'm getting error on a.save! when path is like: appendixes/appendixes/242/original/%25C5%2581A%25CC%25A8KA.jpg, but works like charm when it is: appendixes/appendixes/243/original/laka.jpg or another file name without polish letters. Anybody had this kind of problem or have suggestions how to fix it?
Ok, I found what was wrong. I had to replace in a.s3path, the last part with original name (łąka.jpg) and everything works fine. So when I have:
S3File.new(appendixes/appendixes/243/original/łąka.jpg) it works good and finds the correct file on s3 server.
Content type not recognizing while uploading files using paperclip + jquery file upload.
Throwing below error "content type discovered from file command: CDF V2 Document, No summary info. See documentation to allow this combination"
fail to upload the same.
We can fix this issue by adding below file in the intializers in rails -
# config/initializers/paperclip.rb
Paperclip.options[:content_type_mappings] = {
:xls => "CDF V2 Document, No summary info"
}
This solve my problem, hope this will help you as well.
Thank you.
In order to allow users to upload documents on my website, I am trying to add form validation on a symfony2 application. According to this doc : http://symfony.com/doc/current/reference/constraints/File.html , I should create a validation.yml file with this syntax :
# src/Acme/BlogBundle/Resources/config/validation.yml
Acme\BlogBundle\Entity\Author
properties:
bioFile:
- File:
maxSize: 1024k
mimeTypes: [application/pdf, application/x-pdf]
mimeTypesMessage: Please upload a valid PDF
I have tried to type/edit this file in a lot of ways, yet I always get a parsing error when the file is executed :
Unable to parse in "\/***\/***\/dev\/***\/src\/***\/***Bundle\/Resources\/config\/validation.yml" at line 1 (near "***\***\Entity\Author").
I tried to test this code with this online YML parsing tool : http://yaml-online-parser.appspot.com/, and it says the colon on line 3 just after "properties" is wrong :
Output
ERROR:
mapping values are not allowed here
in "<unicode string>", line 3, column 13:
properties:
^
What am I missing here? Why is the YML syntax used in symfony documentation not accepted by this online parser? Note that I am aware of the tab indentation vs. space indentation for .yml files.
I try to load a yaml file into an array but it fails with undefined method `join' for "a b c":String
# Check certain temporarily emails
# Throw notice not accepted use other email
require 'yaml'
bad_hostnames = YAML::load(File.read("#{Rails.root}/config/bad_hosts.yml"))
if /^(#{bad_hostnames.join("|")})$/.match(host)
errors.add(:email, "Please not use a disposable mailbox")
end
So i required yaml before and on top of the model, controller where I load the yml in:
require 'yaml'
Still same result, in rails console this works flawlessly, what am I missing?
The above code is inside my user.rb model, in console it works
EDIT:
bad_hosts.yml looks like (shortened) 1 provider the line
0-mail.com
10minutemail.com
30minutemail.com
4warding.net
Your .yml file is not a YAML file.
This would make it .yml file.
- 0-mail.com
- 10minutemail.com
- 30minutemail.com
- 4warding.net
But when you want to load just a file line by line try the following:
lines = IO.readlines("#{Rails.root}/config/bad_hosts.yml")
# note: lines end in "\n"
I get this error in view: couldn't parse YAML at line 20 column 14
Here:
Rails internationalisation help
And here:
Rails 3 simple form error : couldn't parse YAML
How do I fix it?
You most likely did not end put a whitespace at the end of your YAML file.
Putting the Quotes fixed my error:
couldn't parse yaml at line 18
Put the password in config/database.yml into quotes
username: dbadmin
password: "?!?!?pass?!?!?word?!?!"