ruby on rails - url helper for namespace nested model -


i using public_activity gem. use gem, not need create activities controller it. did not. however, have comments controller. want have following url helper comment's create action:

public_activity_activity_comments_path(@activity)   

i have tried 2 things in routes , both have failed. first, tried using namespace route:

  namespace :public_activity     resources :activity       resources :comments     end   end 

this produces error:

actioncontroller::routingerror - uninitialized constant publicactivity::commentscontroller: 

since not have publicactivity::activities controller, tried instead:

get '/public_activity/activity/:activity_id/comments/new', to: 'comments#new' post '/public_activity/activity/:activity_id/comments', to: 'comments#create' 

however, not seem produce url helpers @ all, gives me following error:

nomethoderror - undefined method `public_activity_activity_comments_path' #<#<class:0x007f868e1b7760>:0x007f868e1afd58>: 

the reason why want route because in comments view, commentable can model, prefer have polymorphic form:

<%= form_for [commentable, comment.new] |f| %>   ... 

am out of luck? have hardcore url form_for?

imho, need play polymorphic association , form, public_activity record activities if correctly configure any model of yours.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -