Friends I have something like this:
user.rb:
class User < ActiveRecord::Base
has_one :address, autosave: true, dependent: :destroy
accepts_nested_attributes_for(:address, update_only: true, allow_destroy:true)
end
address.rb
class Address < ActiveRecord::Base
belongs_to :user
belongs_to :country
belongs_to :state
belongs_to :city
validates :country_id, presence: true, on: :update
validates :state_id, :city_id, presence: true, on: :update, if: :is_brasil?
def is_brasil?
country_id.eql? 34
end
end
When saving the user update form, when I do not fill state_id and / or city_id I have:
Address state can not be empty
Address city can not be empty
My question is how to translate the Address state and Address city items.
Thank you!