Domanda

Questo è quello che sto cercando:

require "active_support"

desc "test"
task :foo => [:environment] do
  parse(:categories) do |hash|
    # cleanup name
    hash[:name] = titlecase(hash[:name])
    # ...
  end
end

Questo è l'errore che sto ricevendo:

  

metodo non definito `Titlecase' principale: Oggetto

Ho anche provato:

ActiveSupport::Inflector::titlecase(hash[:name])

I risultati in questo errore:

  

metodo non definito `Titlecase' ActiveSupport :: inflettore: Modulo

È stato utile?

Soluzione

try

hash[:name] = hash[:name].titlecase

invece di quello che si sta cercando. ha funzionato per me.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top