I´m adding numbers to a database from fields in a form, but I want to
include some information I have in a variable not generated in this
form.
The variable user.company exists in the same class as create(), and I
want to include the value of this variable when I add new numbers to
the database.
The form looks like this:
Number
<%= text_field 'number', 'number' %>
Name
<%= text_field 'number', 'name' %>
def create @number = Number.new(params[:number])
end
How can I make “create” include the value of user.company or $company?
This should be put in the “company” field of the Numbers database.
Numbers contains the following fields: id, number, name, email, list,
company
I�m adding numbers to a database from fields in a form, but I want to
include some information I have in a variable not generated in this
form.
The variable user.company exists in the same class as create(), and I
want to include the value of this variable when I add new numbers to
the database.
The form looks like this:
Number
<%= text_field 'number', 'number' %>
Name
<%= text_field 'number', 'name' %>
def create @number = Number.new(params[:number])
end
How can I make “create” include the value of user.company or $company?
This should be put in the “company” field of the Numbers database.
Numbers contains the following fields: id, number, name, email, list,
company