Closed preese13 closed 7 years ago
Push your code to github and share a link so we can see your code.
Also when including an inline code block in issues, use 3 backticks on each side of the block, and the language code (rb
for ruby in this case) to get correct formatting:
```rb # Your code goes here ```
You can edit your original comment by clicking the ✏️ icon and change the formatting.
when on my item show page, I get the error
undefined method `index' for #
on the line containing "@index_of = session.index(@item.id)"
to me, my syntax looks proper. I made sure that the session is initialized before using the page, and when looking at the parameters passed to the method it is the correct item ID. Through testing of other aspects of the app, I am sure that my sessions array works properly, but upon inspecting of these few lines, I am unable to pinpoint exactly what is wrong with my declarations.
def show @item = Item.find(params[:id]) @index_of = session.index(@item.id) @next_index = session.index(@item.id) +1 @prev_index = session.index() -1 end