768x90 Getting Online Shouldn't be Tough- $7.49 .com Domains at Go Daddy

How to Modify Error_Messages_for in Production Mode


When you make an application using ruby on rails, the models will validate input of users, if error, your view will display messages from models with followed official statement like " X errors prohibited this object from being saved ". and "There were problems with the following fields:". Now you think how to change it in your own country language. What i have done is i put the script below in appz_name/app/helpers/application_helper.rb


module ApplicationHelper

def error_messages_for(*params)
options = params.last.is_a?(Hash) ? params.pop.symbolize_keys : {}
objects = params.collect {|object_name| instance_variable_get("@#{object_name}") }.compact
count = objects.inject(0) {|sum, object| sum + object.errors.count }
unless count.zero?
html = {}
[:id, :class].each do |key|
if options.include?(key)
value = options[key]
html[key] = value unless value.blank?
else
html[key] = 'errorExplanation'
end
end
header_message = "Telah Terjadi Kesalahan, Harap Perhatikan Hal-Hal Berikut"
error_messages = objects.map {|object| object.errors.full_messages.map {|msg| content_tag(:li, msg) } }
content_tag(:div,
content_tag(options[:header_tag] || :h2, header_message) << content_tag(:p, 'Daftar error:') << content_tag(:ul, error_messages), html ) else ''
end
end
end

Have Nice Try and Good Luck

2 Response to "How to Modify Error_Messages_for in Production Mode"

Jessica L. Smith said...

Hello friend, i want to share my testimony on how i got my BLANK ATM card which have change my life today. i was once living on the street where by things were so hard for me, even to pay off my bills was very difficult for me i have to park off my apartment and start sleeping on the street of Vegas. i tried all i could do to secure a job but all went in vain because i was from the black side of America. so i decided to browse through on my phone for jobs online where i got an advert on Hackers advertising a Blank ATM card which can be used to hack any ATM Machine all over the world, i never thought this could be real because most advert on the internet are based on fraud, so i decided to give this a try and look where it will lead me to if it can change my life for good. i contacted this hackers and they told me they are from Australia and also they have branch all over the world in which they use in developing there ATM CARDS, this is real and not a scam it have help me out. to cut the story short this men who were geeks and also experts at ATM repairs, programming and execution who taught me various tips and tricks about breaking into an ATM Machine with a Blank ATM card.i applied for the Blank ATM card and it was delivered to me within 3 days and i did as i was told to and today my life have change from a street walker to my house, there is no ATM MACHINES this BLANK ATM CARD CANNOT penetrate into it because it have been programmed with various tools and software before it will be send to you. my life have really change and i want to share this to the world, i know this is illegal but also a smart way of living Big because the government cannot help us so we have to help our self. if you also want this BLANK ATM CARD i want you to contact the Hackers email on jameshacker157@gmail.com and you life will never remain the same email jameshacker157@gmail.com

Chris Richard said...

Hello everyone i just want to share my experience with you all. I have being hearing about this blank ATM card for a while and i never really paid any interest to it because of my doubts. They are really good at what they are doing. Back to the point, I inquired about The Blank ATM Card. If it works or even Exist.
They told me Yes and that its a card programmed for random money withdraws without being noticed also has a technique that makes it impossible for the CCTVs to detect you can also be used for free online purchases of any kind. This was shocking and i still had my doubts. Then i gave it a try and asked for the card and agreed to their terms and conditions.
Two days later i received my card and tried with the closest ATM machine close to me
It worked like magic. I was able to withdraw up to $1,000 daily. This Cards comes in Visa/MasterCard. Therefore it works at any ATM Machine that accept Visa/MasterCard Worldwide. This was unbelievable and the happiest day of my life. So far i have being able to withdraw up to $20,000 without any stress of being caught. I don't know why i am posting this here, i just felt this might help those of us in need of financial stability. Mrs Susan has really change my life. If you want to contact them, Here is the email address}} atmmachine137@gmail.com
And I believe they will also change your life too.
Email: atmmachine137@gmail.com

 
powered by Blogger