我使用carmen rails gem来选择国家和地区。在实现数据库后,保存国家代码和次区域代码。
我可以使用下面的代码从代码中获取国家名称
@country_name = Carmen::Country.coded(country_code)
现在我想从子区域代码中获取子区域名称。
帮我解决这个问题。
发布于 2012-12-29 10:10:01
与Carmen::Country一起使用的coded和named方法也可以与subregions集合一起使用。
@country = Carmen::Country.coded(country_code)
@subregion = @country.subregions.coded(subregion_code)https://stackoverflow.com/questions/14010158
复制相似问题