This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| context "on GET to /tickets/" do | |
| setup do | |
| get :index | |
| end | |
| should_respond_with :success | |
| should_render_template :index | |
| should_not_set_the_flash | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ActionView::TemplateError: You have a nil object when you didn't expect it! | |
| The error occurred while evaluating nil.name | |
| On line #13 of app/views/tickets/index.html.erb | |
| 10: | |
| 11: <% for ticket in @tickets %> | |
| 12: <tr> | |
| 13: <td><%=h ticket.category.name %></td> | |
| 14: <td><%=h ticket.employee_name %></td> | |
| 15: <td><%=h ticket.email %></td> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def index | |
| @tickets = Ticket.find(:all) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <tr> | |
| <td><%=unless ticket.category.nil? | |
| h ticket.category.name | |
| else | |
| "Błędna kategoria!" | |
| end | |
| %></td> | |
| <td><%=h ticket.employee_name %></td> | |
| <td><%=h ticket.email %></td> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <table> | |
| <tr> | |
| <th>Od:</th> | |
| <th>Wiadomosc:</th> | |
| </tr> | |
| <% for message in messages %> | |
| <tr> | |
| <td><%=h message.from %></td> | |
| <td><%=h truncate(message.content, :length => 80) %></td> | |
| <td><%= link_to 'Pokaz', message %></td> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NoMethodError in Tickets#show | |
| Showing app/views/messages/_messages.html.erb where line #6 raised: | |
| You have a nil object when you didn't expect it! | |
| You might have expected an instance of Array. | |
| The error occurred while evaluating nil.each | |
| Extracted source (around line #6): | |
| 3: <th>Od:</th> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <% unless @ticket.messages.empty? %> | |
| <h3>Wiadomości:</h3> | |
| <%= render :partial => "/messages/messages", :locals => { :messages => @ticket.messages } %> | |
| <% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #migracja pierwsza | |
| class AddBasicStateColumnToTickets < ActiveRecord::Migration | |
| def self.up | |
| add_column :tickets, :basic_state, :string | |
| end | |
| def self.down | |
| remove_column :tickets, :basic_state, :string | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class AddStatesToDevData < ActiveRecord::Migration | |
| def self.up | |
| tomek_ticket = Ticket.find_by_employee_name("Tomek") | |
| adiego_ticket = Ticket.find_by_employee_name("Adiego") | |
| tickets = {tomek_ticket.id => { "basic_state" => "opened" }, adiego_ticket.id => { "basic_state" => "closed", "order_number" => "0000" } } | |
| Ticket.update(tickets.keys, tickets.values) | |
| =begin | |
| tomek_ticket.basic_state = "opened" | |
| adiego_ticket.basic_state = "closed" | |
| tomek_ticket.save! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Migrating to AddStatesToDevData (20090906115422) | |
| Ticket Load (2.0ms) SELECT * FROM `tickets` WHERE (`tickets`.`employee_name` = 'Tomek') LIMIT 1 | |
| Ticket Load (0.0ms) SELECT * FROM `tickets` WHERE (`tickets`.`employee_name` = 'Adiego') LIMIT 1 | |
| Ticket Load (0.0ms) SELECT * FROM `tickets` WHERE (`tickets`.`id` = 963368505) | |
| SQL (0.0ms) BEGIN | |
| Category Load (1.0ms) SELECT * FROM `categories` WHERE (`categories`.`id` = 1304086846) | |
| Category Load (1.0ms) SELECT `categories`.id FROM `categories` WHERE (`categories`.`name` = BINARY 'Wysyłka' AND `categories`.id <> 1304086846) LIMIT 1 | |
| Ticket Update (0.0ms) UPDATE `tickets` SET `order_number` = 0, `updated_at` = '2009-09-06 12:48:32' WHERE `id` = 963368505 | |
| SQL (25.0ms) COMMIT | |
| Ticket Load (21.0ms) SELECT * FROM `tickets` WHERE (`tickets`.`id` = 1113204912) |