Class: Jets::Router::MethodCreator::Edit

Inherits:
Code
  • Object
show all
Defined in:
lib/jets/router/method_creator/edit.rb

Instance Method Summary collapse

Methods inherited from Code

#action, #full_as, #full_meth_name, #full_path, #initialize, #meth_args, #meth_result, #method_name_leaf, #param_name, #path_method, #url_method

Methods included from Util

#get_controller_action, #handle_on!, #join, #underscore

Constructor Details

This class inherits a constructor from Jets::Router::MethodCreator::Code

Instance Method Details

#meth_nameObject



3
4
5
6
7
8
9
10
# File 'lib/jets/router/method_creator/edit.rb', line 3

def meth_name
  path_items = @path.to_s.split('/')
  if method_name_leaf && path_items.size != 3
    nil # fallback: do not define url method
  else  # comes from resources
    join(action, singularize(full_as), singularize(method_name_leaf))
  end
end