Q:

field name in forms must match model attribute names in RAILS 4?

Does Rails always map out the model attribute name using name="example" in the form? 
this means that the name attribute on a form field has always strictly match the db column name that the ActiveRecord model is mapped to? 
for example, in my code 
<%= form_for(@property, :url => landlord_properties_path(current_landlord),:html => {:class => 'form-horizontal'}) do |f| %>
<%= render 'shared/error_messages' , object: f.object %>
<div class="form-group selection property type">

  <%= f.text_field :locality, 'name'=>"locality" %>
  <%= f.text_field :country, 'name'=>"administrative_area_level_1" %>

  <%= f.submit "add", class: "btn btn-s-md btn-success pull-right"  %>

  <% end %>

I have an attribute in my AR called :locality that matches my db column name :locality 
I also have another attribute named :country, but because in the form, the name is being overridden to 'name'=>"administrative_area_level_1" it seems like the data isnt being passed through to AR
I am overriding the name because I am using Geocomplete, and those name fields are used to make google map api calls. 'name'=>"administrative_area_level_1" is really not convenient to have in a database. 
here is my strong parameter method for property
  def property_params
       params.permit(:postal_code,:place_id,:country,:locality)
  end

this currently does not work, no value is passed into :country
if i add :administrative_area_level_1 to params.permit, then rails complains 
unknown attribute: administrative_area_level_1

which I am guessing is because I dont have it in my db.
Is there a way for me to map name= administrative_area_level_1 field to :country column  in my app?

A:

in your model you can define the following method:
def administrative_area_level_1=(input)
  self.country = input # Or do what ever you want with the input to map it to country
end

