Friday, 15 February 2013

routes error in rails -


I am working on a project. I am making an application where a user can add a problem (like post ) And the user can comment on it

On running this application, I get an error Could not find the problem with 'id' = show : Problems are Resources: Comments End Users 'Get To' / 'Receive' Users / Make The 'user' / show 'user receives / Edit' issue '/ show /: id',: to = & gt; 'Issues # Show' Resources: User Resources: Session, Only => [: Create: new, delete] Get '/ signup', to: to = & gt; 'User # get new' / signin ',: to = & gt; 'Session # new' get / signout ',: to = & gt; 'Session is deleted' code for problem controller

  class IssuesController & lt; ApplicationController def new @issue = Issue.new end def vs. @USUSU = Issue.New (issues_image) if the @ issue Ascouch Flash [: Success] = 'Your injury has increased' redirect_to: controller = & gt; 'Issues',: verb = & gt; 'Show' ,: ID = & gt; @ Issue.Edit other render 'new' end-end def. Tissue = issue Address (Param [: ID]) End DEF Update @ Issue = Issue. Address (params [: id]) if the @ issue.update_datas (issues_most) redirect_to: controller = & gt; 'Issues',: verb = & gt; 'Show' ,: ID = & gt; @ Issue. Id other render 'and end and die index' euze = issue Show all F.Df @UUEU = Issue FIDEF (Param [: ID]) Dislike FFF @ issue = issue.fund (PARAM [: ID]) @dstoy redirect_to: controller = & gt; 'Issues',: verb = & gt; Contains the 'index' end-protected issues issues (at: issue) .permit (: title: content); end end  

From the code for the comment controller where I see the issue in the controller

  Class Comments Controller & lt; ApplicationController def @issue = Issue.find (params [: issue_id]) @comment = @ issue.comments.create (comment_params) If @ comment.save redirect_to: admin = & gt; 'Issues',: verb = & gt; 'Show' ,: ID = & gt; @ Tissue [: id] and then 'new' end-end private def comment. Ultimate params.require (: Comment). Pure (: End of content) end  

You can find the URI / issues / show should try to request? This is related to the resources of your paths GET / issues /: id from resources: problems line router parameter [: id] to string "Show" and show to will send a request for action IssuesController which, as you've shown, then Issue.find (Params [: id]) will try to do this. Problem Address ("show") and therefore you get your error.


No comments:

Post a Comment