Tuesday 15 April 2014

ruby on rails - NameError in Discussions#index -


I am trying to write a Ruby app that lets you discuss posts and post comments. The point is that I can not get the comments here - here is the microprost, so that the discussions can be shown below. Now, get the error name in the IM discussion # Index: Undefined local variable or method # & lt; # 0x0000010563a1e0 & gt; 'Discussion' for any idea?

Microprost Form

  & lt;% @micropost = micropost.new%> & Lt;% = form_for (@micropost) do | F | | & Gt%; & Lt;% = Render 'shared / error_messages', object: f.object% & gt; & Lt; Div class = "field" & gt; & Lt;% = f.text_area: Content, placeholder: "Write new microform ..."% & gt; & Lt; / Div & gt; & Lt;% = f.hidden_field: discussion_id, discussion.id% & gt; & Lt;% = f.submit "post", category: "btn btn-big btn-primary"%> & Lt;% end% & gt;   

Microprost controller

  Class Microfost Controller & lt; ApplicationController before_filter: sign_in_user, only: [: create], delete] can create DIF index end df @description = current_useor. Discus. NY @ microcost = current_user Microfost Build (Param [[Microprost]) if @ microfost. Success] = "Posted!" Redirect_to root_url Submit another 'static_pages / home' End End End of Df End   

Discussion Controller

  Class Discussions Controller & lt; ApplicationController before_filter: sign_in_user, only: [: index, edit]: update] df show @ user = user.fid (param [: id]) @destation = @ user dascusion. Paginate (page: params [: pages]) @Mcprosts = @User Microstost.pignet (page: params [: pages]) and def index @ biscus = Discussion. All fdf can make @descriptation = current_useor.disition.bild (paraam [: discussion]) if @ talk savvy flash [: success] = "The discussion started!" Redirect_to root_url Submit another 'static_pages / home' end-end DRF end DEF update end DEF New End End   

Discussion View

   & Lt; / Section & gt; & Lt; / One side & gt; & Lt; / Div & gt; & Lt;% end% & gt;   

Thanks for the help, I'm sure there is something really simple in this code.

In this code,

  class discussions controller & lt; ApplicationController before_filter: sign_in_user, only: [: index, edit]: update] df show @ user = user.fid (param [: id]) @destation = @ user dascusion. Paginate (page: params [: pages]) @Mcprosts = @User Your question is probably  @ user.discussions    

@ user.discussion / Code> should be. Similarly with the next line, @ user.microposts

No comments:

Post a Comment