These are part of my routes.
activity_groups GET /activity_groups(.:format) activity_groups#index
POST /activity_groups(.:format) activity_groups#create
new_activity_group GET /activity_groups/new(.:format) activity_groups#new
edit_activity_group GET /activity_groups/:id/edit(.:format) activity_groups#edit
activity_group GET /activity_groups/:id(.:format) activity_groups#show
PUT /activity_groups/:id(.:format) activity_groups#update
DELETE /activity_groups/:id(.:format) activity_groups#destroy
root / main#index
Minimal view:
activity_groups/show
%h2 Activity Ggroup
%h3= @activity_group.title
= link_to "Edit", edit_activity_group_path(@activity_group)
|
= link_to "Delete", activity_group_path(@activity_group), {confirm: (I18n.t "confirmations.activity_group.delete"), method: :delete}
|
= link_to "Back", activity_groups_path
The index is a little bit more complex:
activity_groups/index
.row
.span8
%h1.padding_bottom1 Activity Groups
- if !@activity_groups.empty?
%ul.span6
%li.span1 F
%li.span2 Name
%li.span2 Actions
= render @activity_groups
= render @activities
- else
%h2.extra_padding You have no Activity Groups yet. Add one and start managing your time.
.span6.padding_top1
=link_to "Create Activity Group", new_activity_group_path, {class: 'btn'}
=link_to "Create Activity", new_activity_path, {class: 'btn'}
activity_groups/_activity_group.html.haml
%ul.span6
%li.span1
%i.icon-folder-close.folder
%li.span2
= activity_group.title
%li.span2
PROBLEM
- if !activity_group.activity_groups.empty?
- activity_group.activity_groups.each do |activity_group|
= render partial: 'activity_group', locals: {activity_group: activity_group}
- if !activity_group.activities.empty?
- activity_group.activities.each do |activity|
= render partial: 'activities/activity', locals: {activity: activity}
PROBLEM If i place a link_to "Show", activity_groups_path(activity_group) here my routes go crazy. My activity_groups_path is gone. I can’t access it anymore. It tries to redirect me to the show view and not to the index view. I really don’t understand why this happens. Any ideas?
[EDIT1]
I started with a clean database. If I try to place a link for the show page now I get a NameError undefined local variable or methodactivity_group_path’`
[EDIT2] corrected misspell above
Are you passing object to your link path?