[Rails] launch many daemons from script/xxx

2009-02-02 Thread joserwan
Hello, I try to launch many daemons from a script written in the script/repository. One daemon is launched per site (AR model "Site"). I want to load Rails environment just once. Each time a daemon is launched, script exits. I tried to "encapsulate" daemon launching in threads, but I have the sa

[Rails] Class Variable accessibility in multiple rails instance

2008-11-26 Thread joserwan
Hello, I have a rails application, wich display data from database. I have a ruby script wich load rails environment and fill the database. I would like to do a cache system for the model X, while my ruby script puts data model X < ActiveRecord::Base @@cached_data = {} def after_create

[Rails] Re: What's the cleanest way to add have a start / stop control with EventMachine

2008-11-13 Thread joserwan
Here's what I did : # = # script/em_manager # I did a chmod +x on this file #!/usr/bin/env ruby require 'rubygems' require 'daemons' options = { :app_name => "em_manager", #:ARGV => ['start', '-f', '--', 'param_for_myscript'] #:dir_mode => :nor

[Rails] Re: Problem with inheritance and find

2008-11-11 Thread joserwan
In facts, as Person.all gave me Men and Fathers, I had require_dependency 'father' in the Man class. On 11 nov, 11:08, Frederick Cheung <[EMAIL PROTECTED]> wrote: > On Nov 11, 3:40 pm, joserwan <[EMAIL PROTECTED]> wrote: > > > > > > > Hi,

[Rails] Re: Problem with inheritance and find

2008-11-11 Thread joserwan
Works fine, thank you very much ! On 11 nov, 11:08, Frederick Cheung <[EMAIL PROTECTED]> wrote: > On Nov 11, 3:40 pm, joserwan <[EMAIL PROTECTED]> wrote: > > > > > > > Hi, > > > I've got 3 classes : > > > class Person < ActiveRe

[Rails] Problem with inheritance and find

2008-11-11 Thread joserwan
Hi, I've got 3 classes : class Person < ActiveRecord:Base end class Man < Person end class Father < Man end When I call Man.all, I expect to have men and fathers, but I don't. When I call Person.all, I have people, men and fathers... Do I have to redefine the find method of the Father's clas

[Rails] Re: @collection.each{|item| ...} => item = nil ???

2008-10-20 Thread joserwan
No, the problem is out of there... thank you for the idea ! On Oct 20, 11:53 am, "Craig Demyanovich" <[EMAIL PROTECTED]> wrote: > If you rename the call variable in your block to, say, phone_call, does that > make a difference? I can't find call on the reserved word list for Ruby or > Rails, b

[Rails] @collection.each{|item| ...} => item = nil ???

2008-10-20 Thread joserwan
Hi, I really don't understand : In a partial, I have a collection "@users", in wich I included "calls" : User.all(:include => :calls") in my controller. So, in the partial, I have something like : <% @users.calls.each{|call|%> <%=h call.from %> <% } %> And the error is that i can't get ni

[Rails] inheritance models and data model

2008-10-04 Thread joserwan
Hello, What is the better way to organize database in case of inheritance models ? If I have 2 classes : class Person < ActiveRecord::Base attr :name, :adress end class Teacher < Person attr :school end I'll have à table people with fields name, adress and school. Is there the bet

[Rails] Re: Auto refresh field

2008-09-25 Thread joserwan
ed&r=67&sa=X&;...> > rails<http://www.google.com/url?q=http://www.answers.com/rails&r=67&sa=X&oi...> > * > Any ideas ?? > > 2008/9/24 Alexandre Petitjean <[EMAIL PROTECTED]> > > > > > Ok, i do understand the idea, but i don't know w

[Rails] Re: Auto refresh field

2008-09-24 Thread joserwan
Hello, Look at the prototype helper : periodically_call_remote It will call an action each X second. In this action, you should have a render like : render :update do |page| page['my_field_id'].replace_html "updated!" end On Sep 24, 4:14 am, Alex2101 <[EMAIL PROTECTED]> wrote: > Hi, > > I w