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 | |
| @ticket = Ticket.new(params[:ticket]) | |
| @category = Category.find(@ticket.category_id) | |
| # if (@category.tickets << @ticket) | |
| flash[:notice] = "Ticket created." | |
| redirect_to(@ticket) | |
| else | |
| render :action => "new" | |
| end | |
| en |
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 | |
| @ticket = Ticket.new(params[:ticket]) | |
| @category = Category.find(@ticket.category_id) | |
| # if (@category.tickets << @ticket) | |
| flash[:notice] = "Ticket created." | |
| redirect_to(@ticket) | |
| else | |
| render :action => "new" | |
| end | |
| en |
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 | |
| @ticket = Ticket.new(params[:ticket]) | |
| @category = Category.find(@ticket.category_id) | |
| # if (@category.tickets << @ticket) | |
| flash[:notice] = "Ticket created." | |
| redirect_to(@ticket) | |
| else | |
| render :action => "new" | |
| 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
| def create | |
| @ticket = Ticket.new(params[:ticket]) | |
| @category = Category.find(@ticket.category_id) | |
| if (@category.tickets << @ticket) | |
| flash[:notice] = "Ticket created." | |
| redirect_to(@ticket) | |
| else | |
| render :action => "new" | |
| 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
| <% form_for(@ticket) do |f| %> | |
| <%= f.error_messages %> | |
| <p> | |
| <%= f.label :category_id %><br /> | |
| <%= f.select(:category_id, @categories.collect { |c| [ c.name, c.id ] }) %> |
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 |
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 |
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
| 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
| <% 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> |
OlderNewer