[Dbix-class] Newbie question about relations

Diego M. Vadell dvadell at linuxclusters.com.ar
Tue Oct 17 17:34:20 CEST 2006


Hi Dave and Matt,
    That fixed it. The "new" column is now "c_new", thank you very much.

 -- Diego.
   

On Tuesday 17 October 2006 05:50, Dave Howorth wrote:
> Diego M. Vadell wrote:
> > Hi,
> >   I am just starting with DBIx::Class and Catalyst, and quite frankly I
> > don't know much about designing the tables. I decided to start exploring
> > Catalyst by making a simple file server via web, with sqlite tables:
> >
> > CREATE TABLE Files (
> >             id          INTEGER PRIMARY KEY,
> >             filename       TEXT
> >     );
> >
> >     CREATE TABLE Perms (
> >             file_id     INTEGER,
> >             user_id     INTEGER,
> >             read        BOOLEAN,
> >             del         BOOLEAN,
> >             new         BOOLEAN,
> >             PRIMARY KEY (file_id, user_id)
> >     );
> >     CREATE TABLE Users (
> >             id          INTEGER PRIMARY KEY,
> >             username    TEXT,
> >             password    TEXT
> >     );
> >
> > The idea is that the "Files" tables has a filename, the "Users" have
> > username and password and "Perms" have the ACL of every file wrt every
> > user. I can $schema->populate Files and Users, but when I try to do it
> > with Perms, I get:
> >
> > Can't use string ("WFSDB::Perms") as a HASH ref while "strict refs" in
> > use at /usr/lib/perl5/site_perl/5.8.5/DBIx/Class/InflateColumn.pm line
> > 168.
>
> Just yesterday, I got this error:
>
>   Can't use string ("DBSchema::EntryAttributes") as a HASH ref
>   while "strict refs" in use at
>   /usr/lib/perl5/site_perl/5.8.6/DBIx/Class/InflateColumn.pm line 168.
>
> The good news for me, and perhaps you, is that I know what caused my error!
>
> This error is DBIC's oh-so-subtle way of telling me that I have a column
> name in my database that conflicts with a DBIC method name. In my case,
> I happen to know it is 'belongs_to'.
>
> To find out if this is the case for you, run your script in the debugger
> and look at the stack backtrace you get when it dies. For me, the name
> of the column is in the second level down, like this:
>
>   DBIx::Class::InflateColumn::get_column('DBSchema::EntryAttributes',
>   'belongs_to') called at
>   /usr/lib/perl5/site_perl/5.8.6/DBIx/Class/Row.pm line 241
>
> HTH, Dave
>
> _______________________________________________
> List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> Wiki: http://dbix-class.shadowcatsystems.co.uk/
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
> Searchable Archive:
> http://www.mail-archive.com/dbix-class@lists.rawmode.org/



More information about the Dbix-class mailing list