Thank you.
After many different tries I ended up renaming my table to user_votes
and everything seemed to work at last.

It does get confusing!


On Jun 12, 10:01 am, Dima <dmitriy.pind...@gmail.com> wrote:
> You can include the following in your model to specify the name of the
> table to use if you do not want to follow Cake's naming convention.
> Try this:
>
> [code]
> var $useTable = <your table name>;
> [/code]
>
> So your model will look something like this:
>
> [code]
> class User extends AppModel
> {
>    var $name = 'User';
>    var $useTable = 'user_votes';
>    var $hasAndBelongsToMany = array(
>       'UserVote' => array(
>          'className' => 'UserVote',
>          'foreignKey' => 'user_id',
>          'dependent' => true
>       )
>    );}
>
> [/code]
>
> Hope this helps,
> Dima
>
> On Jun 11, 4:55 pm, Ed Propsner <crotchf...@gmail.com> wrote:
>
>
>
> > All of my underscored table names work just fine, but this is something I
> > wonder about:
>
> > If both parts of the underscored table name are plural (users_votes) ..
> > would the model be UsersVote or UserVote. Do both parts get singularized?
>
> > In any case, your issue still seems to be with naming conventions.
>
> > - Ed
>
> > On Fri, Jun 11, 2010 at 5:43 PM, Jonathon Musters <luvz2...@gmail.com>wrote:
>
> > > I think the new table should be called UsersVotes. No underscore.
>
> > > On 6/11/10, Andrew <grie...@gmail.com> wrote:
> > > > Hello all,
>
> > > > I've been using cakephp for a few months now and I love it!! I must
> > > > admit I am still getting used to some of the concepts. At the moment
> > > > I'm trying to add a database bridging table for a HasAndBelongsToMany
> > > > Model. My three models involved are Users, Votes and Users_Votes.
>
> > > > So when I call the view /users_votes/create/ I get the error message
>
> > > > Missing Database Table
> > > > Error: Database table user_votes for model UserVote was not found.
> > > > Notice: If you want to customize this error message, create app/views/
> > > > errors/missing_table.ctp
>
> > > > I am using Cakephp 1.3.
>
> > > > - My database names are Users, Votes and Users_Votes
> > > > - My model names are user, vote, and uservote
> > > > - I think I have my models correct
>
> > > > class User extends AppModel
> > > > {
> > > >     var $name = 'User';
>
> > > >        var $hasAndBelongsToMany = array(
> > > >         'UserVote' => array(
> > > >                 'className' => 'UserVote',
> > > >                 'foreignKey' => 'user_id',
> > > >                 'dependent' => true
> > > >         )
> > > >     );
> > > > }
>
> > > > class UserVote extends AppModel
> > > > {
> > > >     var $name = 'UserVote';
>
> > > >       var $belongsTo = array
> > > >       (
> > > >         'Vote' => array
> > > >               (
> > > >                'className'  => 'Vote',
> > > >                'foreignKey' => 'id'
> > > >         )
> > > >     );
> > > > }
>
> > > > class Vote extends AppModel
> > > > {
> > > >     var $name = 'Vote';
>
> > > >       var $hasAndBelongsToMany = array
> > > >       (
> > > >         'UserVote' => array(
> > > >                 'className' => 'UserVote',
> > > >                 'foreignKey' => 'vote_id',
> > > >                               'dependent' => true
> > > >         )
> > > >     );
> > > > }
>
> > > > Thanks!
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > > others
> > > > with their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google 
> > > > Groups
> > > > "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.c
> > > >  om>For more options, visit this group at
> > > >http://groups.google.com/group/cake-php?hl=en
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.c
> > >  om>For more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to