I thought this would be super simple but its turning into a pain in the butt.
I need to create a function that will accept a string and return it re-formatted as a URL slug. For example I'd pass in the string "The Adventures of Huckleberry Finn" and my function would return the string "the_adventures_of_huckleberry_finn". I have no problem doing the actual conversion. However in Ember actions can only return True, False or Undefined so the action always returns an object named Undefined rather than the string I told it to return.
How can I go about creating this function/action/computed property in my controller so that it correctly returns the formatted string? I have attempted to just add a normal JS function into the controller. I also tried to define this as a computed property but this action will be used only in the controller, the template has no need to know anything about the slug so a computed property dosn't really make sense and I couldn't get it to work anyways.