In my rails app, I have a namespace in my route file,
namespace :account do
resources :activities
end
My controller is
class Account::ActivitiesController < Account::AccountController
before_action :find_activity, only: [:show, :edit]
def index
@activities = Activity.all
end
def show
end
private
def find_activity
@activity = Activity.find(params[:id])
end
def activity_params
params.require(:activity).permit(:name, :description)
end
end
In my index view I'n trying to access the show page by do this:
= @activities.each do |activity|
= link_to "show", account_activity_path(activity)
When I'm running rake route, I get this result:
account_activities GET /account/activities(.:format) account/activities#index
POST /account/activities(.:format) account/activities#create
new_account_activity GET /account/activities/new(.:format) account/activities#new
edit_account_activity GET /account/activities/:id/edit(.:format) account/activities#edit
account_activity GET /account/activities/:id(.:format) account/activities#show
PATCH /account/activities/:id(.:format) account/activities#update
PUT /account/activities/:id(.:format) account/activities#update
DELETE /account/activities/:id(.:format) account/activities#destroy
When I'm taping directly localhost:3000:/account/activities/1, I'm going to the right page, but when I click on the show link in my index view, I'm getting this error:
No route matches [GET] "/account/undefined"
I'm using rails 4, and everything worked fine until today. I don't see what's happen so if you have any ideas, could be great
Thanks a lot
= link_to "show", account_activity_path(activity.id)
? - Richard Peckto_params
onActivity
model or are you using any gem doing that (e.g. friendly_id)? - BroiSatse