ruby on rails - How can I use polymorphic_path from Observer model's hook (rails4) -


i can use app.polymorphic_path(mymodel.first) console. nothing works that:

class modelsobserver < activerecord::observer   observe :my_model, :my_model2   def publish_data(rec) # rec model instance      amqp_publish({       # ...       # show_path: rails.application.helpers.polymorphic_path(rec)       # show_path: actiondispatch::routing::polymorphicroutes.polymorphic_path(rec)       show_path: application.polymorphic_path(rec)     }) 

etc


Comments