app/helpers/application_helper.rb
# Create a url for a record that links to the proper controller
Create a url for a record that links to the proper controller
Create a url for a record that links to the proper controller
def url_for_db(db, action = "show", item = nil) 
    if item && restful_routed?(item)
      return polymorphic_path(item)
    end
    if @vm && ["Account", "User", "Group", "Patch", "GuestApplication"].include?(db)
      return url_for(:controller => "vm_or_template",
                     :action     => @lastaction,
                     :id         => @vm,
                     :show       => @id
                    )
    elsif @host && ["Patch", "GuestApplication"].include?(db)
      return url_for(:controller => "host", :action => @lastaction, :id => @host, :show => @id)
    elsif db == "MiqCimInstance" && @db && @db == "snia_local_file_system"
      return url_for(:controller => @record.class.to_s.underscore, :action => "snia_local_file_systems", :id => @record, :show => @id)
    elsif db == "MiqCimInstance" && @db && @db == "cim_base_storage_extent"
      return url_for(:controller => @record.class.to_s.underscore, :action => "cim_base_storage_extents", :id => @record, :show => @id)
    elsif %w(ConfiguredSystem ConfigurationProfile).include?(db)
      return url_for(:controller => "provider_foreman", :action => @lastaction, :id => @record, :show => @id)
    else
      controller, action = db_to_controller(db, action)
      return url_for(:controller => controller, :action => action, :id => @id)
    end
  end
def url_for_db ( db , action = "show" , item = nil ) if item && restful_routed? ( item ) return polymorphic_path ( item ) end if @vm && [ "Account" , "User" , "Group" , "Patch" , "GuestApplication" ] . include? ( db ) return url_for ( :controller => "vm_or_template" , :action => @lastaction , :id => @vm , :show => @id ) elsif @host && [ "Patch" , "GuestApplication" ] . include? ( db ) return url_for ( :controller => "host" , :action => @lastaction , :id => @host , :show => @id ) elsif db == "MiqCimInstance" && @db && @db == "snia_local_file_system" return url_for ( :controller => @record . class . to_s . underscore , :action => "snia_local_file_systems" , :id => @record , :show => @id ) elsif db == "MiqCimInstance" && @db && @db == "cim_base_storage_extent" return url_for ( :controller => @record . class . to_s . underscore , :action => "cim_base_storage_extents" , :id => @record , :show => @id ) elsif %w( ConfiguredSystem ConfigurationProfile ) . include? ( db ) return url_for ( :controller => "provider_foreman" , :action => @lastaction , :id => @record , :show => @id ) else controller , action = db_to_controller ( db , action ) return url_for ( :controller => controller , :action => action , :id => @id ) end end
Create a url for a record that links to the proper controller
Create a url for a record that links to the proper controller
# Default action is show
db
<not_specific>
action
<not_specific>
item
<not_specific>