Sha256: c56b63b5bf82434629cfa84779423f8f10b1bc49a5154c3af97c3861463a33b2
Contents?: true
Size: 1.08 KB
Versions: 18
Compression:
Stored size: 1.08 KB
Contents
class AdminAssistant class Route attr_reader :admin_assistant def initialize(admin_assistant) @admin_assistant = admin_assistant end def add(binding) route_str = "resources(:#{resource})" unless autocomplete_actions.empty? route_str << " do " autocomplete_actions.each do |action| route_str << " get :#{action}, :on => :collection;" end route_str << " end " end if namespace route_str = "namespace(:#{namespace}) do " + route_str + " end" end eval(route_str, binding) end def autocomplete_actions admin_assistant.autocomplete_actions end def controller admin_assistant.controller_class end def namespace name = controller.name.gsub(/Controller$/, '').underscore if name =~ %r|(.*)/(.*)| $1.to_sym end end def resource name = controller.name.gsub(/Controller$/, '').underscore if name =~ %r|(.*)/(.*)| $2.to_sym else name.to_sym end end end end
Version data entries
18 entries across 18 versions & 1 rubygems