开发者

Calling an action in another controller

开发者 https://www.devze.com 2023-02-09 22:02 出处:网络
I have a situation like when i submit the employee form i need to check for a boolean value in employee_controller if it is set then i need to invoke a create action in AddressController. what is the

I have a situation like when i submit the employee form i need to check for a boolean value in employee_controller if it is set then i need to invoke a create action in AddressController. what is the best way to do it ? Whether i need to create开发者_如何学编程 an instance like AddressController .new and call the method ? and there is no relationship between employee and address.


Why do you need to call an action in AddressController when you submit and Employee form?

A better/cleaner idea might be to interact with the Address model from within the Employees_controller. Nothing wrong with that!

0

精彩评论

暂无评论...
验证码 换一张
取 消