ruby - Force return after render in rails controller? -


using rails 4.2.1

i want write function forces controller called in render , return. possible?

def error!   # stuff define error   # render error   render end  def somecontroller < actioncontroller::metal   include abstractcontroller::rendering   include actioncontroller::rendering   include abstractcontroller::callbacks   include actioncontroller::renderers::all   include actioncontroller::implicitrender   def some_action     if       # - continue     else       # bad - error!       error!       # how force controller stop execution , return here?       # return error! #       # in error! function?     end     puts 'still running'   end end 

check

def some_action    if      # - continue    else               return error!             end   puts 'still running' end 

another option raise exception within error!, , have rescue_from block @ applicationcontroller level


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -