-1

I cannot find out how to have my gem append a column to an existing model/table. My gem needs to check the created_at attribute of a model, and based on time passed, set an active column from true to false. I'm assuming that, upon install, it will end up needing a

$ rails {gem_name}:install

type call from the terminal to append the active column to the model's table. I don't think that an engine is the way to go because I'm not creating any models in the gem, and the only migration I need is to alter an existing model.

Any links, tutorials or advice will be greatly appreciated.

tshepang
  • 12,111
  • 21
  • 91
  • 136
Sparkmasterflex
  • 1,837
  • 1
  • 20
  • 33

2 Answers2

0

It seem you are a beginner. What do you think reading the fine manual on

 http://guides.rubyonrails.org/getting_started.html
devanand
  • 5,116
  • 2
  • 20
  • 19
  • 1
    Don't be a dillhole. There's a difference between doing rails apps and creating a gem/engine. Clearly you're a beginner with dealing with people – Sparkmasterflex Dec 20 '13 at 14:51
  • @Sparkmasterflex i don't know the expression dillhole. but as i read that you try to update with a gem a model in rails i thought you miss quite a lot basics. sorry if i made you angry? – devanand Dec 20 '13 at 14:54
  • the Devise gem does this, so I know its possible and maybe even common. now devise is an engine w/ its own routes and such, but it does have the ability to create a model for the actual rails app or append to an existing model. – Sparkmasterflex Dec 20 '13 at 15:03
  • @Sparkmasterflex `rails g devise:...` the "g" is missing :) – devanand Dec 20 '13 at 15:07
0

I finally found the answer to this issue after posting the question again with a little more information and a little more background.

Please see it here

Basically following the devise gem code base and parsing out what I did and didn't need

Community
  • 1
  • 1
Sparkmasterflex
  • 1,837
  • 1
  • 20
  • 33