Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9182207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:30:21+00:00 2026-06-17T18:30:21+00:00

I have a User model and a Storefront model. For some reason, when I

  • 0

I have a User model and a Storefront model.

For some reason, when I try to go to /storefronts/new I get this error:

Routing Error
No route matches {:action=>”edit”, :controller=>”storefronts”,
:id=># Storefront id: nil, name: nil, user_id: 4, created_at: nil,
updated_at: nil, description: nil, location: nil>}

Been at it for 3 hours trying to figure this out. It was working yesterday..
Why does it say :action=>”edit” when its the ‘new’ action?

Here’s my code:

class Storefront < ActiveRecord::Base
  attr_accessible :name, :location, :description
  belongs_to :user
end

class User < ActiveRecord::Base
  attr_accessible :name, :email, :password, :password_confirmation
  has_secure_password
  has_one :storefront
end

class StorefrontsController < ApplicationController
  before_filter :check_auth, only: [:new, :edit, :update]

  def index
    @storefronts = Storefront.all
  end

  def new
    @storefront = current_user.build_storefront
  end

  def create
    @storefront = current_user.build_storefront(params[:storefront])
    if @storefront.save
      redirect_to edit_storefront_path(@storefront)
    else
      render 'new'
    end
  end

def show
    @storefront = Storefront.find(params[:id])
  end

  def edit
    @storefront = Storefront.find(params[:id])
  end

  def update
    @storefront = Storefront.find(params[:id])
    if @storefront.update_attributes(params[:storefront])
      redirect_to @storefront
    else
      render 'edit'
    end
  end
end


Pbf::Application.routes.draw do
  resources :sessions, :only => [:new, :create, :destroy]
  resources :users
  resources :storefronts

  root :to => 'storefronts#index'
  match '/signup',  to: 'users#new'
  match '/login', to: 'sessions#new'
  match '/logout', to: 'sessions#destroy'
end

Link I’m using (Here’s the issue):

  <% if current_user.storefront %>
    <%= link_to "Manage Storefront", edit_storefront_path(current_user.storefront) %>
  <% else %>
    <%= link_to "Open Storefront!", openstore_path %>
  <% end %>

Thanks in advance!

EDIT:
My rake routes

   sessions POST   /sessions(.:format)             sessions#create
new_session GET    /sessions/new(.:format)         sessions#new
    session DELETE /sessions/:id(.:format)         sessions#destroy
      users GET    /users(.:format)                users#index
            POST   /users(.:format)                users#create
   new_user GET    /users/new(.:format)            users#new
  edit_user GET    /users/:id/edit(.:format)       users#edit
       user GET    /users/:id(.:format)            users#show
            PUT    /users/:id(.:format)            users#update
            DELETE /users/:id(.:format)            users#destroy
storefronts GET    /storefronts(.:format)          storefronts#index
            POST   /storefronts(.:format)          storefronts#create  
new_storefront GET    /storefronts/new(.:format)   storefronts#new 
edit_storefront GET    /storefronts/:id/edit(.:format) storefronts#edit
 storefront GET    /storefronts/:id(.:format)      storefronts#show
            PUT    /storefronts/:id(.:format)      storefronts#update
            DELETE /storefronts/:id(.:format)      storefronts#destroy
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:30:22+00:00Added an answer on June 17, 2026 at 6:30 pm

    It looks to me like you have an error in your view. app/views/storefronts/new.html.erb is mistakenly referencing edit_storefront_path without passing storefront_id as a parameter. You probably want storefronts_path

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to MVC. You have been warned... I have User model that can
I have a User model. If I do: def my_action @user = User.new end
I have a user model like this: class User < ActiveRecord::Base validates :password, :presence
Ok i have this in what i have user.rb //user model OPTION = ['none',
I have a user model: class User < ActiveRecord::Base end This model is used
I have a user model that is generated using Devise. I am extending this
Let's say I have User model and Post model. Post model contains field user_id
I have a User model that has many posts. Im trying to render the
I have a user model on which I check to make sure that the
I have a user model that requires the user to change their password every

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.