1
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 cannot go blank
Address city cannot go blank
My question is how to translate the Address state and Address city items.
Thank you very much!