I have an error message that appears when my the field for the database :b_name is empty. However, b_name stands for Business Name and I have made the label say that. However, when I get the error message, it says B name cant be blank. Is there any way I can change it so when I get the error it says Business Name can't be blank instead of b_name cant be blank?
Yes it is actually really simple.
You should have a file named config/locales/en.yml, if not simply create one. There you can add your own custom names.
en:
  activerecord:
    models:
      order:            "Order"
    attributes:
      order:
        b_name:         "Business Name"
That will replace your b_name for "Business Name"
Your Order model in app/models/order.rb should look like:
class Order < ActiveRecord::Base
  validates :b_name, :presence => true
  .
  . 
  .
Please let me know if it worked :)
Here is an screenshot of my app working fine.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With