module RailsFriendlyUrls::FriendlyUrl

This module is to be included in the client class that represents the Friendly URL

@author Carlos Alonso

Public Instance Methods

set_destination_data!() click to toggle source

This method tries to identify the route contained at self.path to extract the destination’s controller, action and other arguments and save them into the corresponding controller, action and defaults fields of the including objects.

# File lib/rails_friendly_urls/friendly_url.rb, line 14
def set_destination_data!
  route_info = Rails.application.routes.recognize_path self.path
  self.controller = route_info[:controller]
  self.action = route_info[:action]
  self.defaults = route_info.reject { |k, v| [:controller, :action].include? k }
end