Add a column "on the fly"

Hi people,

Does anybody know if it is possible to create columns on the fly…
so wihout a migration.

I would like to do this so that my customers can create multiple
languages whitout me generating that language for them.

ohw an second question: could I then check if a particularly column
exists ? in a table of course :stuck_out_tongue:

thanxs!

On 8 Dec 2008, at 18:33, jeljer te Wies wrote:

exists ? in a table of course :stuck_out_tongue:

Well you can of course execute arbitrary sql
(ActiveRecord::Base.connection.execute), which could add a column (you
will run into the slight issue that you will need to get all of your
mongrels/mod_rails instances etc… to call
SomeTable.reset_column_information). This sounds like a horrifically
bad idea though

Fred

:frowning: If you put it like that yes !..
Such a shame ! Beceaus it would have been verry cool
To add languages on the fly as a customer :frowning:

Ok wel then I will have to do something with my database design
So that I would be possible… But it won’t be pritty either :frowning:

Thanxs allot though for the reply !
I really apreciate it

Jeljer

Frederick C. wrote:

On 8 Dec 2008, at 18:33, jeljer te Wies wrote:

exists ? in a table of course :stuck_out_tongue:

Well you can of course execute arbitrary sql
(ActiveRecord::Base.connection.execute), which could add a column (you
will run into the slight issue that you will need to get all of your
mongrels/mod_rails instances etc… to call
SomeTable.reset_column_information). This sounds like a horrifically
bad idea though

Fred

On 8 Dec 2008, at 21:28, jeljer te Wies wrote:

:frowning: If you put it like that yes !..
Such a shame ! Beceaus it would have been verry cool
To add languages on the fly as a customer :frowning:

I’ve absolutely no idea what you’re doing or trying to do, but I doubt
that adding columns on the fly is the only way to accomplish what you
want.

Fred

Why can’t you make an additional model “language” and another model of
“message”, then you only need:

language.rb: has_many => :messages
message.rb: belongs_to => :language

Then you might have infinite number of languages with infinite number
of messages ;)))

Good luck! :slight_smile:

On Dec 8, 10:36 pm, Frederick C. [email protected]

Yes thanxs !.. I have thought of the same solution.

I now have the following… :

Languages:
-id
-name

menus
-id
-title
-languages id

This is a much better solution !! … I really don’t know why haven’t
thought of it
sooner.

Thanxs for al the replays guys!.

gr jeljer

Paweł K wrote:

Why can’t you make an additional model “language” and another model of
“message”, then you only need:

language.rb: has_many => :messages
message.rb: belongs_to => :language

Then you might have infinite number of languages with infinite number
of messages ;)))

Good luck! :slight_smile:

On Dec 8, 10:36 pm, Frederick C. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs