# Model using STI new function only working partially

**URL:** <https://www.ruby-forum.com/t/model-using-sti-new-function-only-working-partially/183094>\
**Category:** Rails\
**Created:** [February 8, 2010, 3:21am UTC](https://www.ruby-forum.com/t/model-using-sti-new-function-only-working-partially/183094 "2010-02-08T03:21:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Solly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/43a26b/32.png) [@Solly](https://www.ruby-forum.com/u/Solly)\
**Post date:** [February 8, 2010, 3:21am UTC](https://www.ruby-forum.com/t/model-using-sti-new-function-only-working-partially/183094/1 "2010-02-08T03:21:36Z")

</div>

## Hi, I have an application using STI on a model named Publisher. Publisher uses STI via a column named “service”. When I call

## p = Publisher.new(…, :service =\> “TwitterPublisher”)

## the service does not get assigned, yet all other columns do. However, if I later call

## p[:service] = “TwitterPublisher”

all is well. Any ideas about what is going on? My environment is  
Ruby 1.9/1.8.6 with Rails 2.3.5 running on MinGW(1.9) and Linux (1.8.6

- on Heroku). Any idea as to what is going wrong?

Best Regards,  
Solly

---

<div class="post-metadata">

**Author:** ![Solly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/43a26b/32.png) [@Solly](https://www.ruby-forum.com/u/Solly)\
**Post date:** [February 8, 2010, 3:16pm UTC](https://www.ruby-forum.com/t/model-using-sti-new-function-only-working-partially/183094/2 "2010-02-08T15:16:15Z")

</div>

On Feb 7, 7:00 pm, Solly [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> –  
> all is well. Any ideas about what is going on?

inheritance\_column (service in this case) is automatically protected  
against mass-assignment. If you examine your logs carefully, you  
should see some messages about that.

–Matt J.
