Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CONTROLLER:
- class BoardsController < ApplicationController
- def index
- @boards = Board.find(:all)
- end
- end
- VIEW:
- <%for board in @boards%>
- <%=debug(board.topics.last)%>
- <%end%>
- RESULT:
- --- !ruby/object:Topic
- attributes:
- text: Hello World
- title: Hello World
- id: !str 1
- date: 2008-06-14 18:06:56
- board_id: !str 1
- attributes_cache: {}
- ---
- COMMENT: How can i access these attributes? A "board.topics.last.title" brings up a No method error....why?
Add Comment
Please, Sign In to add comment