Re: [Catalyst] schema

2006-12-26 Thread Jonas Alves
my $barneys = $c->model('DB::Person')->search({name => 'barney'}); instead of my $schema = $c->model('DB'); my $barnes = $schema->resultset('Person')->search({name => 'barney'}); And I don't think Model::DBIC::Schema pays attention to the default_model setting. He can use the default_m

Re: [Catalyst] schema

2006-12-24 Thread Robert 'phaylon' Sedlacek
Octavian Rasnita said: >> Beware though that this probably means you can't access a DBIC resultset >> directly via $c->model('DB::Foo'); > > Ok, but how? Um, how _what_? It would be very helpful if you'd write whole questions, not assuming that I know what is on your mind. We both seem to be non

Re: [Catalyst] schema

2006-12-24 Thread Octavian Rasnita
Beware though that this probably means you can't access a DBIC resultset directly via $c->model('DB::Foo'); Ok, but how? Thanks. Octavian ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable

Re: [Catalyst] schema

2006-12-24 Thread Robert 'phaylon' Sedlacek
Octavian Rasnita said: > Finally I think I will need to use such a config file, although the yaml > format is not very friendly. >From the Catalyst::Plugin::ConfigLoader POD: This module will attempt to load find and load a configuration file of various types. Currently it supports YAML, JS

Re: [Catalyst] schema

2006-12-24 Thread Robert 'phaylon' Sedlacek
Octavian Rasnita said: > From: "Jonas Alves" <[EMAIL PROTECTED]> > >> Or you can just use $c->model() and define the "default_model" >> parameter in the config file. > > That's it! Thank you. Beware though that this probably means you can't access a DBIC resultset directly via $c->model('DB::Foo'

Re: [Catalyst] schema

2006-12-24 Thread Octavian Rasnita
From: "Jonas Alves" <[EMAIL PROTECTED]> Or you can just use $c->model() and define the "default_model" parameter in the config file. -- Jonas That's it! Thank you. Teddy ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mail

Re: [Catalyst] schema

2006-12-24 Thread Octavian Rasnita
From: "Robert 'phaylon' Sedlacek" <[EMAIL PROTECTED]> Umm, why don't you just have two config files with different DSNs to your schema? During development, my config has a "dbi:SQLite:..." DSN in it, and the production server uses a postgres one. Finally I think I will need to use such a confi

Re: [Catalyst] schema

2006-12-24 Thread Jonas Alves
If I write the name of the database in more modules it will be harder to change its name, but now I I think that I could use something like: $c->model($c->config->{db}); and just change the name of the db in the application config. Or you can just use $c->model() and define the "default_model"

Re: [Catalyst] schema

2006-12-24 Thread Robert 'phaylon' Sedlacek
Octavian Rasnita said: > I want to test the application using a certain database, and if all works > right, I want to use it with another one, and I don't want to need > creating another Catalyst application just because I have changed the > database. > > [...] > > and just change the name of the

Re: [Catalyst] schema

2006-12-24 Thread Octavian Rasnita
thing like: $c->model($c->config->{db}); and just change the name of the db in the application config. Octavian - Original Message - From: "Robert 'phaylon' Sedlacek" <[EMAIL PROTECTED]> To: "The elegant MVC web framework" Sent: Sunday, D

Re: [Catalyst] schema

2006-12-24 Thread Robert 'phaylon' Sedlacek
Octavian Rasnita said: > I need to access the same database in more controller modules, using the > following line in every subroutine and every module: > > my $schema = $c->model('DB'); > > Is it possible to define it only in one place and make it available in the > entire application? Sorry, I

[Catalyst] schema

2006-12-24 Thread Octavian Rasnita
Hi, I need to access the same database in more controller modules, using the following line in every subroutine and every module: my $schema = $c->model('DB'); Is it possible to define it only in one place and make it available in the entire application? Thanks. Octavian ___