Ruby on Rails "Couldnt find status id" -


I'm projecting this treehouse, some kind of social network has been built with Rail Ruby.

I was trying to make a user unable to update the existing situation from another user and was stuck. This is my position. Rb:

  Class Status Controller & lt; ApplicationController before_filter: authenticate_user!, Only: [: new,: create, edit, update] first_one: set_status, only: [: show,: edit, update: deleted] #GET / status # git /statuses.json Deaf index @statuses = Status.order ("created_at DESC"). To_a end # GET / statuses / 1 # GET /statuses/1.jsondef show end #GET / statuses / new def new @status = Status.new end # GET / statuses / 1 / edit def Edit End # POST / Status # POST /statuses.json def can be created @status = current_user.statuses.new (status_params) response_to do | Format | If the @ status.save format.html {redirect_to @status, notice: 'the situation was created successfully.' } Format.json {Render Action: 'Show', Status :: created, Location: @ Status} and Format Html {Action: 'new'} format.json {render json: @ position Errors, Position :: Inappropriate} End End # Patch / Pet / Status / 1 # Patch / Put / Station / 1 JSN DIF Update @status = current_user.statuses.find (Params [: id]) Parameters [: Status] .delete (: user_id) If the consultation [: Status] Has_key? (: User_id) response_to do | Format | If @ Status .update (status_params) format.html {redirect_to @status, notice: 'The situation was updated successfully.' } Format.json {head: no_content} else format.html {render action: 'edit'} format.json {render json: @ status.errors, status :: unprocessable_entity} End and #delee / status / 1 # delete / Conditions / 1. Delete Jason DF @ Status. Give feedback on Destor. Format | Format.html {redirect_to statuses_url} format.json {head: no_content} Use Callback to share common setup or barriers between end-end personal # tasks def set_status @status = Status.find (params [: id]) End # Scary Do not trust the criteria from the Internet; Allow only through white list   

While doing this test (if a user logs in 'Status updates for the current user should do'). ), I got the following error:

  1) Error: status controller test # test_should_update_status_for_the_current_user_when_logged_in: ActiveRecord :: RecordNotFound: ID = 980190 962, status can not be found [WHERE "statuses" "User_id" =?] AP / controller / status_center RB: 45: 'Update' Test / Controllers / Status_center_stest. RB: 76: 'block in and lieutenam; Class: Status Controller Trust & gt; 2) Error: StatusesControllerTest # test_should_update_status_when_logged_in: Status with ActiveRecord :: RecordNotFound: id = 980190962 [where "situations". "User_id" =?] AP / Controller / Status_transfer Rb: 45: `Update 'test / Controllers / Conditions_controller_test. RB: 70:` Block in & lt; In the Category: Position Controller & gt; '12 tests, 24 claims, 0 failures, 2 errors, 0 skips   

This is my statuses_controller_test.rb:

  test "Status when logged in Must sign in "sign-in user (gustavo): update, id: @ status, status: {content: @ status.content} assert_redirected_to position_path (assigns (position)) end test" The user should update the status to "sign_in users (: gustavo) put: update, id: @ status, status: {content: @ status.content, user_id: users (: paul) .id } assert_redirected_to position_path (assigns (: (condition)) assert_equal assigns (: status) .user_id, user (: gustavo). End   

and this is my stability users.yml:

  Gustavo: first_name: "Gustav" lastname: "piavo" email: "gustavorpaiva @ gmail. Com "profile_name:" grpaiva "paul: first_name:" paul "last_name:" McCartney "email:" paulmccartney@gmail.com "profile_name:" paulpaul "  

I used Rail 4.0.4 I have been using, and I have already made some fixtures on the code of the Treebook so that it can work strictly (I think it was made with Rail 2.x) should it be or should I I'm missing something here ?

Ps: This is my project link before making this change

Thank you!

Try @zent.id just to put it instead @status < The "sign-in user" (gustavo) should be updated when the "class =" lang-ruby prettyprint-override "> test" is logged in: update, id: @ status .id, status: { Content: @ status.content} assert_redirected_to position_path (assigns (position))

If this does not work, then how can you create the @status object in the administration test? Are you

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -