I am working with Devise gem and I created a show
page for users. My idea was to make a simple path like www.website.com/:id
and I configured it as shown below:
devise_for :users, path: '', path_names: {sing_in: "login", sing_out:
"signout", sing_up: "signup", edit: "edit"},
:controllers => {:registrations => :registrations }
resources :users, only: [:show]
get '/:id' => 'users#show', as: :profile
My routes work fine but besides show
page, I have pages under static controller
for example about
page. I want to be able to access it like www.website.com/about
, here is how I define my static routes
:
get '/about', to: 'static#about'
Now, if I am trying to redirect to about page
, I am getting an error:
ActiveRecord::RecordNotFound in UsersController#show
Couldn't find User with 'id'=about
Here is my users_controller.rb
:
class UsersController < ApplicationController
def show
@user = User.find_by_id(params[:id])
@services = @user.services
end
...
end
I tried to search for the similar errors but haven't found anything like this. Can someone please tell me what I am doing wrong?
Thank you for your help and time.