hello thank you for your reply
i will explain to you a little more the problem :
i created a scafold :
./script/generate scaffold Zone name:string interface:string
description:string
all works fine .
than i changed <%= f.text_field :interface %> to
<%= f.select :interface , @table_Interfaces %>
@table_interfaces is an array witch contains all network interface in
the linux machine .
in my controller i have :
@interfaces=%x[ifconfig|grep Link|cut -d " " -f 1]
@table_Interfaces=@interfaces.split(" ")
and at this step all works fine . i can make all the operation on my
object Zone.
then i wanted to make some validation in the model .
i aded this in my model file Zone.rb :
class Zone < ActiveRecord::Base
validates_presence_of :name
end
Now when i want to create a new zone :
if i enter all the attribute it works fine .
if i don't enter the name i have this error :
Showing app/views/zones/new.html.erb where line #12 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.inject
Extracted source (around line #12):
<%= f.select :interface , @table_Interfaces %>
witch mean that the model don't know the object @table_Interfaces
witch is declared only on the controller no ?
should I add something in my model file related to @table_Interfaces ?
thank you very much for your help . i am a newbie in ROR world but i
have searched a lot without result .