Save userform data in database


I have a form like this.

<% form_for(@search) do |f| %>
  <%= f.error_messages %>

    <%= f.label :country %><br />
    <%= f.text_field :country %>

    <%= f.label :city %><br />
    <%= f.text_field :city %>
    <%= f.submit 'Search' %>
<% end %>

When a user is login i want to store the searches of the form. So the
user view recent searches.

Someone ideas/tips?


"saving data in a database" is pretty basic Rails. :slight_smile:

Perhaps you could pose a more specific question?

OK, sounds pretty straightforward.

User, Search, user has_many searches -- what's the issue?