# Session Problem plz help me

**URL:** <https://www.ruby-forum.com/t/session-problem-plz-help-me/130034>\
**Category:** Rails\
**Created:** [February 24, 2008, 6:27pm UTC](https://www.ruby-forum.com/t/session-problem-plz-help-me/130034 "2008-02-24T18:27:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![suhaib](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e95f7d/32.png) [@suhaib](https://www.ruby-forum.com/u/suhaib)\
**Post date:** [February 24, 2008, 6:27pm UTC](https://www.ruby-forum.com/t/session-problem-plz-help-me/130034/1 "2008-02-24T18:27:45Z")

</div>

first i create the model on the pre-build table product ( i do not  
migrate product table it is already in the database) , after that i  
create the session migrate file ,  
class Sessions \< ActiveRecord::Migration  
def self.up  
create\_table :sessions do |t|  
t.column :session\_id, :string  
t.column :data, :text  
t.column :updated\_at, :datetime  
end

```
add_index :sessions, :session_id
add_index :sessions, :updated_at

```

end

def self.down  
drop\_table :sessions  
end  
end  
.  
but it gives me the error  
\NetBeansProjects\project1\db\migrate\002\_sessions.rb:1: uninitialized  
constant ActiveRecord (NameError)

can any one tell me what is the problem

---

<div class="post-metadata">

**Author:** ![suhaib](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e95f7d/32.png) [@suhaib](https://www.ruby-forum.com/u/suhaib)\
**Post date:** [February 24, 2008, 7:15pm UTC](https://www.ruby-forum.com/t/session-problem-plz-help-me/130034/2 "2008-02-24T19:15:38Z")

</div>

Suhaib Absar wrote:

> but it gives me the error  
> \NetBeansProjects\project1\db\migrate\002\_sessions.rb:1: uninitialized  
> constant ActiveRecord (NameError)
> 
> can any one tell me what is the problem

It looks like you tried to run the migration as a ruby script. Instead,  
just run the following in your project directory (project1):

rake db:migrate

This causes any outstanding migrations to be run against the database.
