Thanks for the explanation.

I have had the create method in my application, it calls
Models::create_scheme, because I have migrations too.
(Everything encapsulated, that's what I like about Camping.)

Actually the problem with X.create was that my
fastcgi-camping-server did not initialize any ActiveRecord
connections, while the standard camping server did.  After I
placed this

ActiveRecord::Base.establish_connection(
        :adapter  => "mysql",
        :host     => "localhost",
        :user     => "*****",
        :password => "******",
        :database => "databasename"
)

before the X.create line, it worked fine.  Anyway that generated
a question.  As you can see I replaced sqlite to mysql,
and now I can see in the mysql database, that table names
are in form of databasename_tablename, and I have an extra
databasename_schema_infos table too.  How can I turn this
behavior off?  It's not critical, but a bit ugly.

uzlee



On Tue, Oct 11, 2011 at 9:50 AM, Magnus Holm <judo...@gmail.com> wrote:

> Now that you have solved your real problem, let me explain this one too:
>
> X.create is purely a convention so you can write code that will run on
> startup inside your application. So you can write this in your
> application:
>
>  def X.create
>    # run migrations etc.
>  end
>
> Then a "proper" Camping server (like your FastCGI-wrapper) will make
> sure to invoke X.create. Of course, a proper Camping server must also
> take care to handle applications that *don't* define X.create, so that
> line should actually look like this:
>
>  # inside the server:
>  X.create if X.respond_to? :create
>
>
_______________________________________________
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to