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
| <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
| <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
| 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
| 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
| 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
| <% for ticket in @tickets %> | |
| <tr> | |
| <td><%=h ticket.category.name %></td> | |
| <td><%=h ticket.employee_name %></td> | |
| <td><%=h ticket.email %></td> | |
| <td><%=h ticket.order_number %></td> | |
| <td><%= link_to 'Pokaż', ticket %></td> | |
| <td><%= link_to 'Edytuj', edit_ticket_path(ticket) %></td> | |
| <td><%= link_to 'Usuń', ticket, :confirm => 'Jesteś pewny?', :method => :delete %></td> | |
| </tr> |
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 validate | |
| errors.add(:category_id, "is not a valid category") if self.category.nil? | |
| 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
| def create | |
| if @ticket.save | |
| flash[:notice] = "ticket created." | |
| redirect_to(@ticket) | |
| else | |
| render :action => "new" | |
| end | |
| end | |
| def validate |
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 Ticket < ActiveRecord::Base | |
| # t.integer :category_id | |
| # t.string :employee_name | |
| # t.integer :order_number | |
| # t.string :email | |
| belongs_to :category | |
| has_many :messages | |
| validates_associated :category |