similar to: autoincrement for non-id column

Displaying 20 results from an estimated 2000 matches similar to: "autoincrement for non-id column"

2006 Apr 30
16
postgresql duplicate key violates unique constraint
I have a weird problem with creating a new record when using PostgreSQL. From inside script/console ... >> entity = Entity.new >> entity.first_name = "Foo" >> entity.last_name = "bar" >> entity.save Throws an exception due to the following SQL error: duplicate key violates unique constraint. The application was working fine before and suddenly
2009 Sep 04
3
libxml-ruby: How to handle XML::Parser::ParseError?
Code: require "rubygems" require "xml" class TaskLoader class BadXML < RuntimeError end def load_tasks doc = XML::Parser.file( "qq.xml" ).parse # ... work with document ... rescue XML::Parser::ParseError, BadXML # this is line #40 # ... end end # TaskLoader p TaskLoader.new.load_tasks # this is line #71 Output: read_xml.rb:40:in
2006 Feb 17
7
Create and then show
I am attempting to redirect to the show method after creating a new object. So, for example, once a new post is created the user is presented with the new post in a show view. The problem is I can''t get the correct <at> post.id to send to the show method. Rails always returns 0 for this value. Here''s what I have so far: class ContentController < ApplicationController
2006 Mar 01
7
Oracle Sequence & Rails
the compiler tell me it: invalid column name: INSERT INTO ago.prova_stats (cognome, nome, id, telefono) VALUES(''Medda'', ''Ivan'', :id, 70565611) where ago.prova_stats is the table used by me and that have only the columns ''cognome'',''nome'' and ''telefono''. My table hasn''t the column
2008 Jan 14
1
How do I add autoincrement?
Hello, I am attempting to learn Ruby on Rails. I''m using Instant Rails 2.0 on a Windows computer. I really want the id number to autoincrement, but I am not sure how to do that. The script that''s generated after the scaffold is listed below. Any help is appreciated. class CreateMenuitems < ActiveRecord::Migration def self.up create_table :menuitems do |t|
2006 Nov 04
0
any recommendations for handling a non autoincrement primary key
Hey everyone, I''m working on an application that has a table with a nice natural primary key. Outside of the rails world it would be *the* primary key. I would prefer to use this natural primary key and define associations that use it. I''ve done so but the problem is that my form for entering a record in this table is currently failing. I''ve used
2008 May 22
4
how to find out autoincrement id ?
Hi I need to push newly created item id to file. (ie. its autoincrement value) I tried this on controller but it wont work, it cant find id value for the newly created item. def create @imitem = Imitem.new(params[:imitem]) system "echo \"@imitem.id\" > /tmp/myid" any help ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you
2006 Feb 09
1
migration with PostgreSQL - function nextval does not exist
This might be a problem with postgresql, but I''m not sure. In a migration I have renamed a table so I wanted to rename a sequencer as well. It looks like: execute "ALTER TABLE global_vacations_id_seq RENAME TO vacations_id_seq;" execute "ALTER TABLE vacations ALTER COLUMN id SET DEFAULT nextval(''vacations_id_seq''::regclass);" But the process of
2006 Apr 13
2
acts_as_versioned gem
I''ve installed the acts_as_versioned gem, and it shows up as installed when i do a "gem list" After installing it, I set up my new model with the "acts_as_versioned" line in its model file. I think went to run my migration to create this table, and I got the following error: == CreateDpslevels: migrating ================================================ --
2006 Feb 14
10
acts_as_versioned and getting authors
Hey guys and gals, I have the following object that has acts_as_versioned: class Note < ActiveRecord::Base acts_as_versioned belongs_to :user end The schema for my notes table is as follows: create_table :notes, :force => true do |t| t.column :id, :integer t.column :noteshare_id, :integer t.column :user_id, :integer t.column :title, :string
2006 Mar 20
3
help: acts_as_versioned setup error "undefined local variable or method ''base_class''"
Hi All, Rails newbie here trying to set up acts_as_versioned according to Chapter 14 in the Rails Recipies book. I''ve taken the following steps (nearly verbatim) as mentioned by the book: - created the target model "Post" - added the "acts_as_versioned" label to the model file - generated a migration file - added the table creation code and the command
2006 Apr 07
2
weird error with rake create_sessions_table
Hi all, Despite switching to mod_fcgid (which has improved performance), sessions are still expiring sporadically. I thought I might try switching to storing them in the db, but I get the following error when I try to run the rake create_sessions_table command D:\User\Code\ruby\prometheus>rake create_sessions_table (in D:/User/Code/ruby/prometheus) rake aborted! undefined local variable or
2008 Dec 01
3
acts_as_versioned and rails 2.2.2
Hi people I have tried to install the acts_as_versioned gem from github in rails 2.2.2 but it seems to conflict with some methods in the activerecords dirty.rb-file. I can solve some of the problem by changing code in the activerecord, but I don''t think that was the intention. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to
2006 Jun 13
9
act_as_versioned and join tables?
Greetings! I''m attempting to use the act_as_versioned plugin to provide versioning functionality for my rails app, but can''t think my way through this: How can you use act_as_versioned to perform versioning on a HABTM join table? It is easy to see how to do so for join models (:has_many :through) but not so for the join table. I want to use act_as_versioned to maintain
2006 May 04
2
Is there a way to version the contents of a table as a set?
I am looking at using acts_as_versioned to manage revisions of data in several tables in my application. However, the default behavior of acts_as_versioned appears to apply to individual rows within a table. The tables I want to version are complicated lookup tables and what I really want is to version the entire contents of each table as a single set. Adding a row, deleting a row, or updating
2006 May 03
6
Versioning the contents of a table as a set
I am looking at using acts_as_versioned to manage revisions of data in several tables in my application. However, the default behavior of acts_as_versioned appears to apply to individual rows within a table. The tables I want to version are complicated lookup tables and what I really want is to version the entire contents of each table as a single set. Adding a row, deleting a row, or updating
2006 Jun 03
1
First time plugin user: Problem with "acts_as_versioned"
Hi, I am having trouble with using the acts_as_versioned plugin. I installed the plugin, and ran the migration. acts_as_versioned created the versioned table OK, but when I try to use it I get an error. Here is some console output: >> m = Mymodel.find(:first) NameError: undefined local variable or method `acts_as_versioned'' for Mymodel:Class Did I miss a step? Ingo --
2006 Feb 17
2
acts_as_versioned and acts_as_taggable on same model?
I am trying to use acts_as_versioned and acts_as_taggable (plugin) on the exact same model. Has anyone successfuly done this? I think what I need to do is make model_versions acts_as_taggable instead of my main model. Anyone have any other suggestions or any suggestions how to do this? Your Friend, John Kopanas http://www.kopanas.com
2005 Dec 27
4
acts_as_versioned
Hi, I'm integrating acts_as_versioned (ar-versioned.rubyforge.org) in my customized CMS rails application to set up revision control for pages. Getting and viewing versions works allright, but when I try to revert to a version in the following way, nothing happens to the actual data in the object. Link from page: <%= link_to image_tag('revert'), :action => 'do_revert',
2006 Apr 18
1
what happened to my increment_counter method?
this used to work for me. i started re-writing my little app and now it doesn''t work. here''s my models: class Company < ActiveRecord::Base has_many :people end class Person < ActiveRecord::Base belongs_to :Company, :counter_cache => true end then i go into my console and say: c = Company.find(:first) c.increment_counter and its all like "waaaaaaH"