2013-06-03 7 views
8

Ogni volta che provo a utilizzare Datetime_select in una vista, l'app genera un errore di attributo.Impossibile usare datetime_select con Mongoide

Mongoid::Errors::UnknownAttribute: 

    Problem: 
    Attempted to set a value for 'fromtime(1i)' which is not allowed on the model Event. 
    Summary: 
    Without including Mongoid::Attributes::Dynamic in your model and the attribute does not already exist in the attributes hash, attempting to call Event#fromtime(1i)= for it is not allowed. This is also triggered by passing the attribute to any method that accepts an attributes hash, and is raised instead of getting a NoMethodError. 
    Resolution: 
    You can include Mongoid::Attributes::Dynamic if you expect to be writing values for undefined fields often. 

La soluzione che ho incontrato il più delle volte è stato quello di includere Mongoid :: MultiParameterAttributes nel modello. Sfortunatamente quel modulo è stato rimosso! https://github.com/mongoid/mongoid/issues/2954

Ho provato a forgiare la gemma e ho aggiunto di nuovo il modulo MultiparameterAttributes, ma la gemma non legge il codice dal file lib. C'è un modo per usare DateTime_select con Mongoid?

+0

è possibile fornire ulteriori informazioni sulla struttura dei dati e su come si tenta di accedere ai dati? – xlembouras

risposta

Problemi correlati