# Sinatra Application with ActivRecord 2.3.9 and MassAssignmen

**URL:** <https://www.ruby-forum.com/t/sinatra-application-with-activrecord-2-3-9-and-massassignmen/196010>\
**Category:** Ruby\
**Created:** [October 5, 2010, 1:44pm UTC](https://www.ruby-forum.com/t/sinatra-application-with-activrecord-2-3-9-and-massassignmen/196010 "2010-10-05T13:44:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![astrid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/919ad9/32.png) [@astrid](https://www.ruby-forum.com/u/astrid)\
**Post date:** [October 5, 2010, 1:44pm UTC](https://www.ruby-forum.com/t/sinatra-application-with-activrecord-2-3-9-and-massassignmen/196010/1 "2010-10-05T13:44:09Z")

</div>

Hi,  
i tried my first sinatra application with ruby 1.9.2 and ActiveRecord  
2.3.9  
and the massassignment doesn’t work. New Database entry is nil for all  
parameters.  
If i use ActiveRecord 2.3.5 everything works fine.  
Anybody an idea if this is an bug?

Here is my source:

The model:

class Tag \< ActiveRecord::Base  
end

The spec:

require ‘service’  
require ‘spec’  
require ‘spec/interop/test’  
require ‘rack/test’  
require ‘/models/tag’

set :enviroment, :test  
Test::Unit::TestCase.send :include, Rack::Test::Methods

def app  
Sinatra::Application  
end

describe “service” do  
before(:each) do  
Tag.delete\_all  
end

describe “GET on /api/v1/tags/:id” do  
before(:each) do  
Tag.create(  
:description =\> “test”,  
:type =\> “some”)  
end  
end  
end

Thanks,  
astrid

---

<div class="post-metadata">

**Author:** ![astrid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/919ad9/32.png) [@astrid](https://www.ruby-forum.com/u/astrid)\
**Post date:** [October 5, 2010, 2:17pm UTC](https://www.ruby-forum.com/t/sinatra-application-with-activrecord-2-3-9-and-massassignmen/196010/2 "2010-10-05T14:17:39Z")

</div>

Astrid Kurbin wrote:

> Hi,  
> i tried my first sinatra application with ruby 1.9.2 and ActiveRecord  
> 2.3.9  
> and the massassignment doesn’t work. New Database entry is nil for all  
> parameters.  
> If i use ActiveRecord 2.3.5 everything works fine.  
> Anybody an idea if this is an bug?

ActiveRecord is a component of Rails; I suggest you ask on a Rails forum  
if it’s a known issue.

IIWM, I’d redo this as a standalone test at the irb prompt (or  
script/console)

> > #ActiveRecord::Base.establish\_connection(…)  
> > #class Tag \< ActiveRecord::Base; … end  
> > Tag.create(…)  
> > Tag.find(:all)

Then it’s explicit that this is an issue with ActiveRecord, and takes  
rspec and sinatra out of the picture. Or alternatively, if that works as  
expected, you can start looking elsewhere for the issue.
