i am using the carmen gem to store the country as their country code like for United states it is US . but when i retrieve the country in the view i retrieve it as their full name
i have a model user and account
class User < ActiveRecord::Base
has_one :account
end
class Account < ActiveRecord::Base
belongs_to :User
end
and
@users = User.includes(:admin, :account).
where.not(admin: { role: 'SUPER' }).where("names like ? OR accounts.country like ?" , "%#{ search }%", "%#{ search }%")
<% @users.each do |user| %>
<%= user.names %>
<%= Carmen::Country.coded(user.account.country).name %>
<% end %>
i have a user query which i have used in the view to find user names with their country but in the search like if i write US it gives me all the names of with country United states but i dont want to search the name with their country code , i want to write the whole country name
i know the issue is in the search query. the country code is stored in the database, so it is searching by the code , but i cant find out how to use carmen country code to their name conversion in the search query Please help , thankx in advance