You need to define fonction
in your model (app/models/employee.rb
)
The way you're using it implies it's defined as both a class method, and an instance method. It also looks like it could be an array? Employee.fonction.map {|r| ...
or an attribute (since you have a select to set it on an employee.)
However, you define fonction as a string...
def fonction
params[:type] || "Employee"
end
So I'm not really sure what you're trying to achieve here... All I know is Employee.fonction
looks like a model class method...
def self.fonction
...
end
and f.select :fonction
looks like an instance method or attribute?
EDIT I think I've got this... (Sorry, I missed fonction
reference in your model definition)
Try adding this to your Employee model:
def self.fonction
["Manager", "Consultant", "Employee"]
end
EDIT #2
You can also define a constant in your model
FONCTIONS = ["Manager", "Consultant", "Employee"]
def fonction
FONCTIONS
end