ouais c'est un peu ca je me suis dis je comprends un peu sur la biblio avec livre , emprunt , usager ...je passe a mon vrai model et la grrrrr
MODELS:
- t2l.rb
Code :
- class T2l < ActiveRecord::Base
- has_one :transport_movement
- end
|
-transport_movement.rb
Code :
- class TransportMovement < ActiveRecord::Base
- belongs_to :lieux
- belongs_to :t2l
- end
|
-lieux.rb
Code :
- class Lieux < ActiveRecord::Base
- has_many :transport_movements
- end
|
CONTROLLERS:
-t2ls_controller.rb
Code :
- class T2lsController < ApplicationController
- def index
- @t2ls = T2l.find(:all)
- end
- end
|
VIEW:
-t2ls/index.html.erb
Code :
- <table>
- <tr><td>id t2l</td><td>id lieux</td></tr>
- <% for t2l in @t2ls %>
- <tr>
- <td><%=h t2l.id %></td>
- <td><%=h t2l.transport_movement.lieux.id %></td>
- </tr>
- <% end %>
- </table>
|
ERROR
Code :
- Showing app/views/t2ls/index.html.erb where line #16 raised:
- "DESC lieuxes" failed; does it exist?
- Extracted source (around line #16):
- 13: <% for t2l in @t2ls %>
- 14: <tr>
- 15: <td><%=h t2l.id %></td>
- 16: <td><%=h t2l.transport_movement.lieux.id %></td>
- 17: </tr>
- 18: <% end %>
- 19: </table>
|