# Database table row creation method

**URL:** <https://www.ruby-forum.com/t/database-table-row-creation-method/162305>\
**Category:** Rails\
**Created:** [March 8, 2009, 10:42am UTC](https://www.ruby-forum.com/t/database-table-row-creation-method/162305 "2009-03-08T10:42:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![renars1985](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/22d042/32.png) [@renars1985](https://www.ruby-forum.com/u/renars1985)\
**Post date:** [March 8, 2009, 10:42am UTC](https://www.ruby-forum.com/t/database-table-row-creation-method/162305/1 "2009-03-08T10:42:33Z")

</div>

I have following view for user input:

# Post new thing
\<%= form\_tag :action =\> 'create' %\>

Title  
\<%= text\_field 'thing', 'title' %\>

Description  
\<%= text\_area 'thing', 'description' %\>

Email  
\<%= text\_field 'thing', 'email' %\>

\<%= submit\_tag "Create" %\> \<%= form\_tag %\>

… and following controller that populates data (one row) in database

def create  
@thing = Thing.new(params[:thing])  
end

So far it is working. But I need to add one more parameter to @thing  
variable that doesn`t come from user input. It comes from another model  
(:another\_main\_thing\_id). What is the syntax for adding this parameter  
to @thing variable.  
Thank you!

---

<div class="post-metadata">

**Author:** ![renars1985](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/22d042/32.png) [@renars1985](https://www.ruby-forum.com/u/renars1985)\
**Post date:** [March 8, 2009, 3:11pm UTC](https://www.ruby-forum.com/t/database-table-row-creation-method/162305/2 "2009-03-08T15:11:29Z")

</div>

On 8 Mar 2009, at 09:42, Renars Sirotins wrote:

> So far it is working. But I need to add one more parameter to @thing  
> variable that doesn`t come from user input. It comes from another  
> model  
> (:another\_main\_thing\_id). What is the syntax for adding this parameter  
> to @thing variable.

There’s an accessor function created for you for each database  
attribute

Fred
