Good evening all.
I have two different places in my app that need to call the same
controller/action and react differently in terms of output. In other
words, in one case I want to use some rjs to update a page in a certain
way and in another case - I’d like to to do something entirely different
to a different/distinct page but use the same controller/action.
Say controller is foo and action is ‘unsubscribe’…
class Foo << ApplicationController
def unsubscribe
foo = SomeModel.find(params[:id])
if foo
SomeModel.delete_all(:condtions…)
end
# in one case i want to update the calling page (x) with some
indication
# in another, the page has a completely different dom and i need to
do something else
render :update do |page|
page.do_something
end
end
end
Is the answer to just create two actions here?