[Nitro] Date in Og

zimba-tm zimba.tm at gmail.com
Fri Nov 25 03:27:59 EST 2005


Some times, Og don't enchant the classes. I don't know how to force
it. It looks like your problem is happening because of that. to_date()
is an Entity method (which gets included in your class when it's
"enchanted")

On 25/11/05, Emmanuel Piperakis <epiperak at softlab.ece.ntua.gr> wrote:
> Hi everybody,
> I just installed 0.25 (to test it on the app during the weekend) and to my
> surprise Date objects still cause problems!
>
> Any ideas?
>
> In my model I have
> class ForeignProject < Project
>    property :invest_size,          Fixnum
>    property :invest_type,          Fixnum
>    property :acquisition_date,     Date
>    property :placement_date,       Date
>    property :sales_commission_per, Fixnum
>
>    def initialize
>      super
>      @placement_date = Date.today
>      @sales_commission_per = Date.today
>      @invest_type = 0
>    end
>
>    def calc(startd, endd, var, datas)
>      sum = 0.0
>      datas.each {|l| sum += l.calc(startd, endd, var)}
>      return sum
>    end
>
> end
>
>
>
> In the controller
>     project.assign_properties(request.params)
>
>
> Error
> Path: /project_save/foreign/new
> undefined method `to_date' for Sun Jan 01 00:00:00 JST 1995:Time
> Click here to reload.
> Click here to go to the referer or the home page.
> Stack Trace
>
> (eval):6:in `__force_placement_date'
> /usr/lib/ruby/gems/1.8/gems/glue-0.25.0/lib/glue/property.rb:81:in
> `populate_object'
> /usr/lib/ruby/gems/1.8/gems/glue-0.25.0/lib/glue/property.rb:59:in
> `populate_object'
> /usr/lib/ruby/gems/1.8/gems/og-0.25.0/lib/og/entity.rb:68:in
> `assign_properties'
> ./src/controller.rb:133:in `project_save'
> (eval):12:in `project_save_action'
> /usr/lib/ruby/gems/1.8/gems/nitro-0.25.0/lib/nitro/controller.rb:104:in
> `method_missing'
> /usr/lib/ruby/gems/1.8/gems/nitro-0.25.0/lib/nitro/render.rb:125:in
> `render'
> /usr/lib/ruby/gems/1.8/gems/nitro-0.25.0/lib/nitro/adapter/webrick.rb:143:in
> `do_POST'
> /usr/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in `service'
> /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
>
> Emmanouil Piperakis (epiperak at cs.ntua.gr)
> {To explore is Human, to Create is Devine,
>   To teach is Primal, to Rule is Sin}
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>


--
Cheers,
  zimba

http://zimba.oree.ch




More information about the Nitro-general mailing list