Hi, first and foremost sorry if my english is not the best.

I want to choose between somo products in a view.

I have tickets and i wanna add tickets_products.

1)ruby script/generate scaffold ticket_product name:string
2) rake db: migrate
3) Models-> ticket belongs to ticketproducts and ticketproducts  has
many tickets.
4) I use Sqlite Manager (firefox pluggin) and I added two ticket
products with this soft in tickets_products table.

5)I wrote this in new.html.erb (ticket view):

<% form_for(@ticket) do |f| %>


  <table class="product" >
    <tr>
    <th><%= _('Product') %></th>
    <th><%= _('Breakdown') %></th>
    <th><%= _('State') %></th>
    </tr>
    <tr>
    <td><%= f.collection_select :ticket_product_id, @ticket_products,
:id, :name, :prompt => _("Select product") %></td>
    <td><%= f.collection_select :ticket_breakdown_id,
@ticket_breakdowns, :id, :title, :prompt => _("Select breakdown") %>
</td>
    <td><%= f.collection_select :ticket_state_id, @ticket_states, :id,
:title, :prompt => _("Select state") %></td>
    </tr>
  </table>


The error is:

 NoMethodError in Tickets#new

Showing tickets/new.html.erb where line #14 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.map

Extracted source (around line #14):

11:     <th><%= 'Estado del producto' %></th>
12:     </tr>
13:     <tr>
14:     <td><%= f.collection_select :ticket_product_id,
@ticket_products, :id, :name, :prompt=> "Seleccione producto" %></td>
15:     <td><%= f.text_field :ticket_breakdown_id %> </td>
16:     <td><


--------------------------------
i don“t ubderstand it, because I have two elements in ticket_products


Somebody can help me please??
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to