I have an address column, but I'm not using :address in my form, instead, I have
:street, :state, :city, :zip columns:
<%= form_for @user, :html => {:multipart => true} do |f| %>
<%= f.label :street %>
<%= f.text_field :street %>
<%= f.label :state %>
<%= f.text_field :state %>
<%= f.label :city %>
<%= f.text_field :city %>
<%= f.label :zip %>
<%= f.text_field :zip %>
<%= f.submit %>
<% end %>
Because I don't have a field for :address, but I would like to compile the information in the form and still insert it into my database. For example
(12345 Maple St, Made City CA 90017 or maybe when I get more advanced, I'll use some gem to compile the given information and put into a correct address format.)
How do I do such a thing?
My controller looks something like this:
def create
@user = User.new(params[:user])
if @user.save
redirect_to @user, notice: "Successfully created."
else
render :action => 'edit'
end
end