# Insert data into databese

**URL:** <https://www.ruby-forum.com/t/insert-data-into-databese/141175>\
**Category:** Rails\
**Created:** [June 23, 2008, 9:35am UTC](https://www.ruby-forum.com/t/insert-data-into-databese/141175 "2008-06-23T09:35:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![soutom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/65b543/32.png) [@soutom](https://www.ruby-forum.com/u/soutom)\
**Post date:** [June 23, 2008, 9:35am UTC](https://www.ruby-forum.com/t/insert-data-into-databese/141175/1 "2008-06-23T09:35:56Z")

</div>

i have 2 veriables…such as

industry = “Oil”  
company = “XXXXX”

again i hv a table named industry\_details…this table contain three  
field i.e IndID, IndType,Ind\_company

Here IndID auto-incriment…

So how can i insert this two data into the database’s table, named  
industry\_details

…If any one please help me i will b very much thankful to him/her

Thanking you…

Waitin for reply

---

<div class="post-metadata">

**Author:** ![soutom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/65b543/32.png) [@soutom](https://www.ruby-forum.com/u/soutom)\
**Post date:** [June 23, 2008, 9:48am UTC](https://www.ruby-forum.com/t/insert-data-into-databese/141175/2 "2008-06-23T09:48:50Z")

</div>

In the create action in your controller u can try this

def create  
your\_code to insert into the first table

@industry\_details = IndustryDetail.new(:IndType =\> params[:industry],  
:ind\_company =\> params[:company])  
@industry\_details.save

end

---

<div class="post-metadata">

**Author:** ![soutom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/65b543/32.png) [@soutom](https://www.ruby-forum.com/u/soutom)\
**Post date:** [June 23, 2008, 11:30am UTC](https://www.ruby-forum.com/t/insert-data-into-databese/141175/3 "2008-06-23T11:30:07Z")

</div>

here i faced 1 problem…

undefined method `IndType=’ for #

this is teh main error…

but there is a field named IndType in IndustryDetail table…

So how can i solv this…  
please help me…

thanking You

On Jun 23, 12:48 pm, “bala kishore pulicherla” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![soutom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/65b543/32.png) [@soutom](https://www.ruby-forum.com/u/soutom)\
**Post date:** [June 23, 2008, 11:57am UTC](https://www.ruby-forum.com/t/insert-data-into-databese/141175/4 "2008-06-23T11:57:09Z")

</div>

:o  
try like this if still any issue paste ur controler and view files

@industrydetails = IndustryDetail.new  
@industrydetails.IndType = params[:industry]  
@industrydetails.IndCompany=params[:company]  
@industrydetails.save

---

<div class="post-metadata">

**Author:** ![soutom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/65b543/32.png) [@soutom](https://www.ruby-forum.com/u/soutom)\
**Post date:** [June 24, 2008, 3:02pm UTC](https://www.ruby-forum.com/t/insert-data-into-databese/141175/5 "2008-06-24T15:02:24Z")

</div>

thakx…

again i am getting the Same error…e.i

undefined method `IndType=’ for #

i can’t understand wat to do…plese hepl me anydoby

thanking you

On Jun 23, 2:56 pm, “bala kishore pulicherla” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![soutom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/65b543/32.png) [@soutom](https://www.ruby-forum.com/u/soutom)\
**Post date:** [June 24, 2008, 3:03pm UTC](https://www.ruby-forum.com/t/insert-data-into-databese/141175/6 "2008-06-24T15:03:35Z")

</div>

thakx…

again i am getting the Same error…e.i

undefined method `IndType=’ for #

i can’t understand wat to do…plese hepl me anydoby

thanking you

On Jun 23, 2:56 pm, “bala kishore pulicherla” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
