Displaying 20 results from an estimated 900 matches similar to: "Postgresql and ActiveRecords problems"
2006 May 28
1
ActiveRecord: FK constraints problem
Hi all.
I have has_and_belongs_to_many association between models: Section and
Content.
class Section < ActiveRecord::Base
acts_as_tree
has_and_belongs_to_many :contents
belongs_to :default_content, :class_name => ''Content'', :foreign_key =>
''default_content_id'', :dependent => :nullify
end
class Content < ActiveRecord::Base
belongs_to
2006 Apr 20
4
ActiveRecord: Many-to-Many problem
I am trying to make many-to-may relationship on classes Section and
Content.
Both Content and Section has:
has_and_belongs_to_many :contents and has_and_belongs_to_many :sections
and I have an exception when trying to access model properties:
"undefined method `add_contents'' for #<Section:0xb745c514>"
def add_content_entry
@section = Section.find(params[:section_id])
2006 Apr 10
4
Many To Many''s Join table attributes + migrations
Hi all,
just joined and have only just kicked off with Rails (coming, but not
departing, from WebObjects development). And so far there seems to be
a lot of promise except for one thing I can''t figure out as yet --
the above problem.
Say I have the following conceptual relationships:
ITEMS <<--->> CARTS
i.e., each item can belong to one or more categories. So really
2006 Apr 15
8
Migrations - adding a new table and automatically creating records
I want to create table called roles and then populate it with some new
records...This doesn''t work. Is there something I''m missing?
Craig
class AddRightsAndRolesTables < ActiveRecord::Migration
def self.up
create_table :roles do |t|
t.column "name", :string
end
Role.reset_column_information
Role.new :name => "Users Admin"
2006 Feb 27
1
How to build a recursive parenting structure?
I''m just getting used to using HABTM structures. Something I''m trying
to do now is create a site that has "sections" each section then could
have a sub "section".
So I built a "sections" table and in the model I included the line
"has_and_belongs_to_many :sections"
I also made a table called "sections_sections" to build the
2006 Apr 21
3
Conceptual q about rails
Classes like activerecord, etc contains strange elements like
''belongs_to :something'', ''has_many :smth'' etc.. what is it? I can''t find
them in ruby lang documentation.. it''s similar to ''attr_accessor'' and
other costructions, how I can create my own constructions and how I must
understand them? Could anyone give me some links
2013 Jan 25
3
how to delete the null elements in list
HI,
I have the list:
> suu
[[1]]
NULL
[[2]]
NULL
[[3]]
item_id prod
1 2
[[4]]
item_id prod
1 2
2 4
how to delete all "NULL" elements from suu to get only
>suu
[[3]]
item_id prod
1 2
[[4]]
item_id prod
1 2
2 4
??
Kind regards,
Tammy
[[alternative HTML version deleted]]
2006 Feb 23
4
MySQL Duplicate Key Error
I am a newbie and I am running into a problem which I cant understand. I
have a table called ''privileges'' which has the following fields
CREATE TABLE `sdqualplanner`.`privileges` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(20) NOT NULL default '''',
`description` varchar(100) NOT NULL default '''',
`section_id`
2006 Apr 22
3
Gems installation into custom directory
I it possible to install gems into custom directory (user dir)? There no
any specific parameters in setup.rm I don''t wanna see unpackaged
binaries into my Debian system ;) Or maybe someone can send me a link
with .deb''s?
Thanks in advance.
2006 May 18
4
WebServices and DateTime - 3 elements of civil date are necessary
I simply trying to receive an array of objects, retrieved by
ActiveRecord from table with datetime column and I have:
test_list(SoapControllerApiTest):
ArgumentError: 3 elements of civil date are necessary
/usr/lib/ruby/1.8/date.rb:1214:in `new_with_hash''
/usr/lib/ruby/1.8/date.rb:1258:in `parse''
....
It''s a bug or I am wrong somewhere?
2008 Jan 13
3
right usage of bdrb
Hi,
i''m going to implement a syndication-service, which will get lists in
xml with some meta-data an enclosed video files, which will get encoded
at the end. The syndication run will be startet every five minutes of
a full hour.
So i thought to build 4 Worker. One for checking which feeds to
syndicate (syndication_worker) at a specific time, one for processing
the list
2009 Sep 07
11
autoincrement for non-id column
There is a table:
execute (<<-SQL)
CREATE TABLE "tasks" (
"id" serial primary key,
"number" serial,
"version" integer DEFAULT 0 NOT NULL,
"latest_version" boolean DEFAULT ''t'' NOT NULL,
"hidden" boolean DEFAULT ''f'' NOT NULL,
"type" character varying (1) NOT
2006 Apr 23
4
ActiveRecord: Exclude some columns while fetching
I have models with large TEXT, BLOB columns and I don''t wanna fetch them
everytime. Is it possible to omit columns when fetching records from DB?
Sorry, if it''s trivial, but I can''t find helpful information in docs.
2006 Dec 11
2
join and sort on 'best match'
Hi Everybody,
I have been breaking my head on the following problem: how to join 2
tables and sort the results on the best match.
explanation:
- there are 3 tables, items, tags and items_tags. The items_tags table
links items to tags.
- I have one item which has certain tags, and I want to look up all the
other items that have those tags as well
- results should be sorted and presented by
2004 Jul 16
2
where to sign up for fwd
Could someone please point me to the proper url to register for a fwd
acount and get a fwd number. I couldn't find it at
www.freeworlddialup.com or fwd.pulver.com
Thanks,
-Galt
--
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
Benjamin Franklin
2005 Dec 15
3
Rails: Select and html forms
I''m close to getting this to work, but not quite there. I''m trying to
implement a dropdown control, with the current choice selected.
I have the following code in the view:
5 <select id="product_product_type" name="product[product_type]">
6 <%=
7 types = ProductType.find(:all, :order => "product_type")
8
2006 May 27
2
Error, in my store provider.
Let me explain the subject title, store provider is Hackey, he''s a NPC
that sells items to my users.
<h1>Welcome to Hackey''s!</h1>
<h3>Catalog</h3>
<table border="2" bordercolor="red">
<% for items in @items -%>
<% temp12 = Item.find(items.item_id) -%>
<tr><td><%= @temp12.name
2006 Mar 29
3
Self-referential many-many joins with :through
I thought I had this nailed but.. now I''m seeing spots..
I''ve included my models below, feel free to ignore them. I''m really
just after an example that works. I couldnt find one on the wiki...
which is fair enough considering Ricks patch:
http://dev.rubyonrails.org/changeset/4022 that fixed them only went
through 5 days ago..
Cheers
-henster
2006 Jun 15
8
postgresql sequence and migrations
I have a specific need to ''fixate'' my ''roles'' table sequence when
migrating.
at migration #4, I have 28 records in my roles tables and I can manually
reset the roles_id_seq but it stands to reason that since I am doing
everything else in the migration, I might as well reset the sequence
there too.
so I tried this in my migration file...
execute
2006 Apr 03
2
problems testing on 1.1 and postgresql
Hi,
I get errors doing this:
1) createdb myapp_test
2) rake db:test:clone_structure
3) rake test:units
rake aborted!
PGError: ERROR: relation "matches" already exists
I''m using the :sql schema format because there are some problems with
postgres and the :ruby schema format
config.active_record.schema_format = :sql
It seems rake test:units is trying to create the tables