I am trying to create a basic user and stores setup whereby stores are nested within users in my routes file as a resource. I have managed to create working forms for to create a new store but the issue I am having is that it's not actually saving anything into my stores table.
I currenltly have the following view (stores#new)
<%= form_for [@user, @store] do |f| %>
<div class = "field">
<%= f.label :name %>
<%= f.text_field :name %>
<%= f.submit "Submit" %>
<% end %>
My routes file is setup as follows:
match "signup" => "users#new"
match "home" => "users#show"
match "update" => "users#edit"
match "stores" => "stores#index"
match "store" => "stores#show"
match "newstore" => "stores#new"
match "updatestore" => "stores#edit"
resources :users do
get "login" => "sessions#new"
post "login" => "sessions#create"
delete "logout" => "sessions#destroy"
get "logout" => "sessions#destroy"
root :to => 'sessions#new'
and I have the following in my Stores controller
@store = Store.new
@user = current_user
@store = @user.stores.build(params[:stores])
I am really quite confused by this as a very similar setup has definitely worked in the past.
Any advice people can offer on this really would be much appreciated