Hello All, I have a table invitation_workflows.Entry to this table is done via method send_invite which is called on the click of an Invite button. When I click on Invite button for the first time,entry gets created in the invitation_workflows table. However on subsequent clicks,the following error is shown *********************************************************************************************************************************** INTERNAL ERROR:Thu Mar 17 17:28:45 +0530 2011 ---------- Client Ip : 127.0.0.1 User Id : 101346 Exception : ActiveRecord::ActiveRecordError: ERROR: column "id" does not exist Position: 322: INSERT INTO "invitation_workflows" ("invitation_workflow_id", "invitor_id", "invited_whom_id", "invited_for_channel_id", "invite_status", "created_by", "updated_by", "created_at", "updated_at") VALUES(NULL, 5088, NULL, 21218, ''P'', ''101346'', ''101346'', ''2011-03-17 11:58:45.553000'', ''2011-03-17 11:58:45.553000'') RETURNING "id" C:/Microblogging_release1.3/vendor/rails/activerecord/lib/ active_record/connection_adapters/abstract_adapter.rb:219:in `log''c:/ jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7- java/lib/active_record/connection_adapters/jdbc_adapter.rb:655:in `select''c:/jruby-1.5.0/lib/ruby/gems/1.8/gems/activerecord-jdbc- adapter-0.9.7-java/lib/active_record/connection_adapters/ jdbc_adapter.rb:578:in `select_one''C:/Microblogging_release1.3/vendor/ rails/activerecord/lib/active_record/connection_adapters/abstract/ database_statements.rb:19:in `select_value''c:/jruby-1.5.0/lib/ruby/ gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/jdbc_adapter/ jdbc_postgre.rb:252:in `insert''C:/Microblogging_release1.3/vendor/ rails/activerecord/lib/active_record/base.rb:2908:in `create''C:/ Microblogging_release1.3/vendor/rails/activerecord/lib/active_record/ timestamp.rb:53:in `create_with_timestamps''C:/Microblogging_release1.3/ vendor/rails/activerecord/lib/active_record/callbacks.rb:266:in `create_with_callbacks''C:/Microblogging_release1.3/vendor/rails/ activerecord/lib/active_record/base.rb:2874:in `create_or_update''C:/ Microblogging_release1.3/vendor/rails/activerecord/lib/active_record/ callbacks.rb:250:in `create_or_update_with_callbacks''C:/ Microblogging_release1.3/vendor/rails/activerecord/lib/active_record/ base.rb:2538:in `save''C:/Microblogging_release1.3/vendor/rails/ activerecord/lib/active_record/validations.rb:1078:in `save_with_validation''C:/Microblogging_release1.3/vendor/rails/ activerecord/lib/active_record/dirty.rb:79:in `save_with_dirty''C:/ Microblogging_release1.3/vendor/rails/activerecord/lib/active_record/ transactions.rb:229:in `with_transaction_returning_status''C:/ Microblogging_release1.3/vendor/rails/activerecord/lib/active_record/ connection_adapters/abstract/database_statements.rb:136:in `transaction''C:/Microblogging_release1.3/vendor/rails/activerecord/lib/ active_record/transactions.rb:182:in `transaction''C:/ Microblogging_release1.3/vendor/rails/activerecord/lib/active_record/ transactions.rb:228:in `with_transaction_returning_status''C:/ Microblogging_release1.3/vendor/rails/activerecord/lib/active_record/ transactions.rb:196:in `save_with_transactions''C:/ Microblogging_release1.3/vendor/rails/activerecord/lib/active_record/ transactions.rb:208:in `rollback_active_record_state!''C:/ Microblogging_release1.3/vendor/rails/activerecord/lib/active_record/ transactions.rb:196:in `save_with_transactions''C:/ Microblogging_release1.3/app/controllers/ invitation_workflows_controller.rb:14:in `send_invite''C:/ Microblogging_release1.3/vendor/rails/actionpack/lib/action_controller/ base.rb:1331:in `perform_action''C:/Microblogging_release1.3/vendor/ rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters''C:/Microblogging_release1.3/vendor/rails/actionpack/lib/ action_controller/filters.rb:610:in `perform_action_with_filters''C:/ Microblogging_release1.3/vendor/rails/actionpack/lib/action_controller/ benchmarking.rb:68:in `perform_action_with_benchmark''C:/ Microblogging_release1.3/vendor/rails/activesupport/lib/active_support/ core_ext/benchmark.rb:17:in `ms''c:/jruby-1.5.0/lib/ruby/1.8/ benchmark.rb:308:in `realtime''C:/Microblogging_release1.3/vendor/rails/ activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms''C:/ Microblogging_release1.3/vendor/rails/actionpack/lib/action_controller/ benchmarking.rb:68:in `perform_action_with_benchmark''C:/ Microblogging_release1.3/vendor/rails/actionpack/lib/action_controller/ rescue.rb:160:in `perform_action_with_rescue''C:/ Microblogging_release1.3/vendor/rails/actionpack/lib/action_controller/ flash.rb:146:in `perform_action_with_flash''C:/Microblogging_release1.3/ vendor/rails/actionpack/lib/action_controller/base.rb:532:in `process''C:/Microblogging_release1.3/vendor/rails/actionpack/lib/ action_controller/filters.rb:606:in `process_with_filters''C:/ Microblogging_release1.3/vendor/rails/actionpack/lib/action_controller/ base.rb:391:in `process''C:/Microblogging_release1.3/vendor/rails/ actionpack/lib/action_controller/base.rb:386:in `call''C:/ Microblogging_release1.3/vendor/rails/actionpack/lib/action_controller/ routing/route_set.rb:437:in `call''C:/Microblogging_release1.3/vendor/ rails/actionpack/lib/action_controller/dispatcher.rb:87:in `dispatch''C:/Microblogging_release1.3/vendor/rails/actionpack/lib/ action_controller/dispatcher.rb:121:in `_call''C:/ Microblogging_release1.3/vendor/rails/actionpack/lib/action_controller/ dispatcher.rb:130:in `build_middleware_stack''C:/ Microblogging_release1.3/vendor/rails/activerecord/lib/active_record/ query_cache.rb:29:in `call''C:/Microblogging_release1.3/vendor/rails/ activerecord/lib/active_record/query_cache.rb:29:in `call''C:/ Microblogging_release1.3/vendor/rails/activerecord/lib/active_record/ connection_adapters/abstract/query_cache.rb:34:in `cache''C:/ Microblogging_release1.3/vendor/rails/activerecord/lib/active_record/ query_cache.rb:9:in `cache''C:/Microblogging_release1.3/vendor/rails/ activerecord/lib/active_record/query_cache.rb:28:in `call''C:/ Microblogging_release1.3/vendor/rails/activerecord/lib/active_record/ connection_adapters/abstract/connection_pool.rb:361:in `call''C:/ Microblogging_release1.3/vendor/rails/actionpack/lib/action_controller/ string_coercion.rb:25:in `call''c:/jruby-1.5.0/lib/ruby/gems/1.8/gems/ rack-1.0.1/lib/rack/head.rb:9:in `call''c:/jruby-1.5.0/lib/ruby/gems/ 1.8/gems/rack-1.0.1/lib/rack/methodoverride.rb:24:in `call''C:/ Microblogging_release1.3/vendor/rails/actionpack/lib/action_controller/ params_parser.rb:15:in `call''C:/Microblogging_release1.3/vendor/rails/ actionpack/lib/action_controller/session/cookie_store.rb:93:in `call''C:/Microblogging_release1.3/vendor/rails/actionpack/lib/ action_controller/failsafe.rb:26:in `call''C:/Microblogging_release1.3/ vendor/rails/actionpack/lib/action_controller/dispatcher.rb:106:in `call''C:/Microblogging_release1.3/vendor/rails/railties/lib/rails/rack/ static.rb:31:in `call''c:/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.0.1/ lib/rack/urlmap.rb:48:in `call''c:/jruby-1.5.0/lib/ruby/gems/1.8/gems/ rack-1.0.1/lib/rack/urlmap.rb:40:in `each''c:/jruby-1.5.0/lib/ruby/gems/ 1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `call''C:/ Microblogging_release1.3/vendor/rails/railties/lib/rails/rack/ log_tailer.rb:17:in `call''c:/jruby-1.5.0/lib/ruby/gems/1.8/gems/ rack-1.0.1/lib/rack/content_length.rb:13:in `call''c:/jruby-1.5.0/lib/ ruby/gems/1.8/gems/rack-1.0.1/lib/rack/chunked.rb:15:in `call''c:/ jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/ mongrel.rb:64:in `process''c:/jruby-1.5.0/lib/ruby/gems/1.8/gems/ mongrel-1.1.5-java/lib/mongrel.rb:159:in `process_client''c:/ jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb: 158:in `each''c:/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/ lib/mongrel.rb:158:in `process_client''c:/jruby-1.5.0/lib/ruby/gems/1.8/ gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in `run''c:/jruby-1.5.0/lib/ ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in `initialize''c:/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/ lib/mongrel.rb:285:in `new''c:/jruby-1.5.0/lib/ruby/gems/1.8/gems/ mongrel-1.1.5-java/lib/mongrel.rb:285:in `run''c:/jruby-1.5.0/lib/ruby/ gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:268:in `initialize''c:/ jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb: 268:in `new''c:/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/ lib/mongrel.rb:268:in `run''c:/jruby-1.5.0/lib/ruby/gems/1.8/gems/ rack-1.0.1/lib/rack/handler/mongrel.rb:34:in `run''C:/ Microblogging_release1.3/vendor/rails/railties/lib/commands/server.rb: 111C:/Microblogging_release1.3/vendor/rails/railties/lib/commands/ server.rb:31:in `require''c:/jruby-1.5.0/lib/ruby/site_ruby/1.8/ rubygems *********************************************************************************************************************************** (The table invitation_workflows has the following columns(invitation_workflow_id,invitor_id,invited_whom_id,invited_for_channel_id,invite_status) What exactly is the problem here,can''t get by what it means. Thanks in Advance Regards Chandrika -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Walter Lee Davis
2011-Mar-17 12:37 UTC
Re: Entry not updated in database table(Active Record Error)
On Mar 17, 2011, at 8:33 AM, Chandu80 wrote:> (The table invitation_workflows has the following > columns > (invitation_workflow_id > ,invitor_id,invited_whom_id,invited_for_channel_id,invite_status) > What exactly is the problem here,can''t get by what it means. > > Thanks in AdvanceWhat the error says is you do not have an id column. All tables which back an ActiveRecord Model must include an auto-incrementing primary key, by tradition named ''id''. There are no exceptions to this as far as I know. If you are making a "join model", then you also have to have an id. The only exception would be a habtm relationship join, which by definition can only have two columns: model_a_id and model_b_id. Walter -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2011-Mar-17 12:38 UTC
Re: Entry not updated in database table(Active Record Error)
On Mar 17, 12:33 pm, Chandu80 <chandu.she...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello All, > > I have a table invitation_workflows.Entry to this table is done via > method send_invite which is called on the click of an Invite button. > When I click on Invite button for the first time,entry gets created in > the invitation_workflows table. > However on subsequent clicks,the following error is shown > > *************************************************************************** ******************************************************** > INTERNAL ERROR:Thu Mar 17 17:28:45 +0530 2011 ---------- > Client Ip : 127.0.0.1 > User Id : 101346 > Exception : ActiveRecord::ActiveRecordError: ERROR: column "id" does > not exist > Position: 322: INSERT INTO > "invitation_workflows" ("invitation_workflow_id", "invitor_id", > "invited_whom_id", "invited_for_channel_id", "invite_status", > "created_by", "updated_by", "created_at", "updated_at") VALUES(NULL, > 5088, NULL, 21218, ''P'', ''101346'', ''101346'', ''2011-03-17 > 11:58:45.553000'', ''2011-03-17 11:58:45.553000'') RETURNING "id"Rails assumes the presence of a primary key column called id. If it''s called something else then you need to tell rails this (via the set_primary_key method). Have you? Fred -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Chandu80
2011-Mar-17 13:00 UTC
Re: Entry not updated in database table(Active Record Error)
Hi Frederick, Thanks for the response.Yes primary key was not set.I set it and it worked. :) Hi Walter, Thanks for the information. :) Regards Chandrika On Mar 17, 5:38 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mar 17, 12:33 pm, Chandu80 <chandu.she...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hello All, > > > I have a table invitation_workflows.Entry to this table is done via > > method send_invite which is called on the click of an Invite button. > > When I click on Invite button for the first time,entry gets created in > > the invitation_workflows table. > > However on subsequent clicks,the following error is shown > > > *************************************************************************** ******************************************************** > > INTERNAL ERROR:Thu Mar 17 17:28:45 +0530 2011 ---------- > > Client Ip : 127.0.0.1 > > User Id : 101346 > > Exception : ActiveRecord::ActiveRecordError: ERROR: column "id" does > > not exist > > Position: 322: INSERT INTO > > "invitation_workflows" ("invitation_workflow_id", "invitor_id", > > "invited_whom_id", "invited_for_channel_id", "invite_status", > > "created_by", "updated_by", "created_at", "updated_at") VALUES(NULL, > > 5088, NULL, 21218, ''P'', ''101346'', ''101346'', ''2011-03-17 > > 11:58:45.553000'', ''2011-03-17 11:58:45.553000'') RETURNING "id" > > Rails assumes the presence of a primary key column called id. If it''s > called something else then you need to tell rails this (via the > set_primary_key method). Have you? > > Fred-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.