You could do http://www.application.com/message/add/contract:1 using
named parameters.

Or setup a route for www.application.com/contract/1/message/add

On Dec 28, 11:09 pm, otisjs01 <[email protected]> wrote:
> OK, so I'm asking lots of questions today...but I really want to
> learn! :)
>
> Anyway, I'm trying to create messages that can be left with a
> contract.
>
> So, I have a Contract model that has the following fields: id, some
> other contract pertinent info. And, a Message model that has the
> following fields: id, contract_id, title, message_text. A Contract has
> many message, and a message belongs to a given contract.
>
> Now, when I display a contract, I want a link that takes the user to a
> page full of messages specific to that contract. Once at the message
> page, they should be able to add a new message, or view existing
> messages. Viewing existing messages is easy, as far as I understand
> it. I'm already doing the same thing all over my application! But,
> creating new messages from this page is something I'm unsure of. How
> do I go about that? How do I store the contract_id in the view so that
> whenever I click "Add new contract" it automatically associates the
> message with the contract. And, so that the user can't accidentally
> add the message to a different contract.
>
> I'm thinking that a url that looks like: <a 
> href="#">http://www.application.com/contract/1/message/add</a> where 1 is the
> contract_id) makes the most sense. I could do this in rails in a few
> seconds...but I can't seem to find a way to do it in CakePHP. The only
> thing I can come up with is: <a href="#">http://www.application.com/
> message/add/1</a> (where 1 is the contract_id).
>
> Am I missing something?
>
> Any help would be appreciated!
>
> Thanks,
>
> Jeremiah

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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to