Re: [Radiant] Can extensions use a different database?
This is a pretty common question with ActiveRecord in general. Essentially, yes you can. Inside your model, I believe you use the establish_connection call. That will connect to the specified database in only that model. Sean p.s. see http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001075 On 3/27/07, Colin Nederkoorn [EMAIL PROTECTED] wrote: We're almost done with our radiant site, but have a few remaining things. I asked a question previously about embedding another RoR app in Radiant. The solution I have right now is to use an iFrame. What's not good about this is you define the size for the iFrame and the screen real-estate used is not dynamically updated - not to mention maintaining another ruby on rails app! My requirements for this app are pretty basic and I should be able to port it to an extension: - take one text box of input (autofilled based on an external database*) - Query the external database* based on the chosen input - Pass part of the result to a c++ console app - Parse the output from the c++ app and display in a table. Where I am uncertain is - Can you query a different database from an extension? If so, how? Thanks! Colin P.S. Since a pic is worth 1000 words... here is a mockup of what I am trying to do. The side and the top menus are rendered in radiant. The input field and result are what my extension needs to handle. My extension needs two pages - an index and a view. The mockup is of the view. ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Can extensions use a different database?
Hi Colin: Colin Nederkoorn wrote: Where I am uncertain is - Can you query a different database from an extension? If so, how? I don't think Rails currently has support for connecting to two databases simultaneously. However, if you are familiar with SQL you can always setup a second database connection in your extension and then manually query the second database with a database interface other than ActiveRecord, e.g. DBI. Of course you won't have the luxurious ActiveRecord wrappers, but you may even be able to bend those to work with a second connection. Cheers, Oliver ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Can extensions...
I'm still new at radiant but my guess is YES and I think this may work: In the migration file for your extension add code to create an entry in the pages table. Something like: Page.create(your params here) On 3/17/07, Karl Doody [EMAIL PROTECTED] wrote: Hi all, I've been playing around with extensions lately and I've got a couple of questions, if anyone can enlighten me: # Can extensions add actual pages to the site on activation? e.g. As in, with slugs / URLs and everything, as if they'd been input through the Admin interface (not as in sub-classing Page etc.). # If not, can extensions add default content (HTML/tags) for a page type? e.g. if I create a page called widgets and set it to my custom page type of WidgetListingPage, can it then be autofilled with some appropriate HTML/tag content? Kind regards, -Karl ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant