Hi everybody,
Is it possible to redirect from the Model?
I would like to redirect in an specific action from afterFind()
callback... but if I set return false in this callback, like it's
possible in beforeSave(), I can't redirect!
Thanks by advance for your ideas.
BR
You shouldn't redirect from a model as a model should only be dealing
with data, not page logic.
You should be doing the redirect in your controller.
What are you redirecting for anyway? If you redirect after finding
data, you'll lose that data and have to find again.
On Apr 30, 11:36 am
Hi Clark,
Thank you for answer.
I don't redirect after find, it's an error in my first post. I would
like to redirect after save!
I know it's a bad idea to redirect from Model, but I'm looking for a
solution to stop action after a record save, like the return false in
before Save.
In fact
On Wed, Apr 30, 2008 at 11:53 AM, avairet [EMAIL PROTECTED] wrote:
In fact, in my Model::afterSave, I do a move_uploaded_file() and if
this move doesn't work, I would like to redirect in the previous
controller action instead of the redirect(index)
You cannot redirect from inside a model
post. I would
like to redirect after save!
I know it's a bad idea to redirect from Model, but I'm looking for a
solution to stop action after a record save, like the return false in
before Save.
In fact, in my Model::afterSave, I do a move_uploaded_file() and if
this move doesn't work, I
PROTECTED] wrote:
In fact, in my Model::afterSave, I do a move_uploaded_file() and if
this move doesn't work, I would like to redirect in the previous
controller action instead of the redirect(index)
You cannot redirect from inside a model, like Clark said. You must
get your model to return
to redirect in the previous
controller action instead of the redirect(index)
You cannot redirect from inside a model, like Clark said. You must
get your model to return some value to the controller that you can use
to determine if you need to redirect or not.
Again, this comes
PROTECTED] wrote:
In fact, in my Model::afterSave, I do a move_uploaded_file() and if
this move doesn't work, I would like to redirect in the previous
controller action instead of the redirect(index)
You cannot redirect from inside a model, like Clark said. You must
get your
)
You cannot redirect from inside a model, like Clark said. You must
get your model to return some value to the controller that you can use
to determine if you need to redirect or not.
Again, this comes with understanding both Cake's conventions and
understanding how Cake's
] wrote:
In fact, in my Model::afterSave, I do a move_uploaded_file() and
if
this move doesn't work, I would like to redirect in the previous
controller action instead of the redirect(index)
You cannot redirect from inside a model, like Clark said. You must
get
10 matches
Mail list logo