Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make gem bundler compatible and remove dependency on activerecord #11

Open
rubish opened this issue Mar 29, 2011 · 10 comments
Open

Make gem bundler compatible and remove dependency on activerecord #11

rubish opened this issue Mar 29, 2011 · 10 comments

Comments

@rubish
Copy link

rubish commented Mar 29, 2011

Thanks for the wonderful gem. I am using it with the mongoid on rails 3.0.4, by including include Escargot::ActiveRecordExtensions in my model and defining table_exists? and find_in_batches method for my models. I also had to include the rake tasks manually and copy the init file to initializers. Till now its working perfectly fine.

There are only few changes required to make the gem compatible with Rails 3.0.4 and MongoID:

  • Make the init file bundler compatible
  • Only do ActiveRecord::Base.class_eval if ActiveRecord::Base is defined
  • Define workaround methods for MongoID(This will only be place holders and might be a little slow as compared to there ActiveRecord counterparts.)

I would love to contribute to the gem, but am currently busy with a project. Let me know if you would like me to work on it.

@jeroig
Copy link
Collaborator

jeroig commented Mar 31, 2011

Thanks you to use it.

Of course you can assist in the development of the gem. We would be grateful.

Only you have to do is : Fork, code, send pull request of your changes.

I remember, in order to maintain the robustness of the gem, any pull request need to pass the test suite. We accepts changes more quickly if it's coming with his own test passed.

Anything you need, let us know.

ps: Sometimes we don't realize the benefits of the change, so (and not always) we ask to you explications Why this change of the new code?, Which are the adventages?

@rubish
Copy link
Author

rubish commented Apr 1, 2011

Thanks for the reply.

Benifits are simple:

  • anyone using rails3 would be able to use the gem, without hacking anything
  • removing ActiveRecord as dependency will make the gem more adaptable by people who are using other ORMs as they only have to figure out how to get it working with there ORM and not how to get rid of activerecord

I would first attempt to get it working with rails3, by making following modifications:

  • move lib/escargot.rb to lib/escargot/escargot.rb
  • copy rails/init.rb to lib/escargot.rb, this is required as the bundler requires lib/.rb instead of rails/init.rb
  • make changes in init.rb and escargot.rb to correctly reference moved files
  • only hook to ActiveRecord if ActiveRecord::Base is defined, to avoid errors if there is no ActiveRecord
  • use Railtie to load rake tasks on rails3

Let me know if it sounds good or I can approach it in a different manner.

PS: I have never worked with gems and plugins and would very much appreciate if you can guide me from where should I start? How to setup my own gem for testing? or point me towards right resources.

@jeroig
Copy link
Collaborator

jeroig commented Apr 4, 2011

Hi rubish,

I'm agree with the changes.
could give me your email? And i explain to you how to configured the project for testing.

Thanks

@pfeiffer
Copy link

Would love to see this happen :-)

@mid9commander
Copy link

I have it working for rails 3 and MongoMapper, I am a bit swamped at the moment to create test for it, if anyone has some time on their hand, they are more than welcome to take what I have in my fork and create test for it.

@jeroig
Copy link
Collaborator

jeroig commented Apr 20, 2011

hi @mid9commander

could give me your email? And i explain to you how to configured the project for testing.

Thanks

@mid9commander
Copy link

check my github profile, I just updated it to have my email address visible. Thank you.

@pfeiffer
Copy link

@jeroig Would it be possible for you to add the testing instructions as a wiki-page in the repository?

@jeroig
Copy link
Collaborator

jeroig commented Apr 20, 2011

hi @pfeiffer,

No problem, i have never use the wiki - page but i will try now

@jeroig
Copy link
Collaborator

jeroig commented Apr 20, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants