Question regarding a model

I have model named Test_session and am trying to add data to it. I have
always been in the situation where I have the user fill out a form and
then create a new entry in a table. This time I am trying to save
sessions of a test where the session has the users id and group they
belong to. I tried doing the following…

@test_session = Test_session.new() or Test_session.new <— I tried
them both
@test_session.user_id = session[:user_id]
@test_session.group = session[:group]
@test_session.save

I get the following error…

Expected /app/models/test_session.rb to define Test_session

Like i said normally I use something on the lines of… @test_session =
Test_session.new(params[:test_session]) where the params comes from a
form. How can you create a new entry in the database without a form and
then set the two fields based of of two values stored in a session

The file does exists and the .rb files for a few other models are also
empty and they work fine… although the entried are filled out through
a form

Ryan B. wrote:

Can you show us the code from test_session.rb? At a guess it’s
TestSession
and not Test_session.

Thanks a lot… my naming was wrong. The file is called test_session.rb
but when you open the file the class is TestSession. I always thought
it was good to use _ in ruby. Maybe just the wrong case here.

Ideally you shouldn’t have underscores in class names anyway; They
should
always be CamelCase.

On Dec 10, 2007 1:47 PM, Hickman H.
[email protected]
wrote:


Posted via http://www.ruby-forum.com/.


Ryan B.
http://www.frozenplague.net

Can you show us the code from test_session.rb? At a guess it’s
TestSession
and not Test_session.

On Dec 10, 2007 1:41 PM, Hickman H.
[email protected]
wrote:

The file does exists and the .rb files for a few other models are also
empty and they work fine… although the entried are filled out through
a form


Posted via http://www.ruby-forum.com/.


Ryan B.
http://www.frozenplague.net

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs