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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 Hickman <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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 Bigg http://www.frozenplague.net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg 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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ideally you shouldn''t have underscores in class names anyway; They should always be CamelCase. On Dec 10, 2007 1:47 PM, Hickman Hickman <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Ryan Bigg 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. > > > > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ryan Bigg http://www.frozenplague.net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---