Rails support #26

Closed
robotex82 opened this Issue May 8, 2012 · 4 comments

Comments

Projects
None yet
3 participants

I forked ib-ruby to add better rails support. Until now I have been able to add following things:

  • Generator for migrations (rails g ib:migrations)
  • Automatic database backed models (no need to require ib-ruby/db
  • Lazy loading of models

Unfortunately I cant use the test suite as i have no paper trading account ATM.

I had to do major changes to the file structure to reflect rails conventions. Basicly I conditionally converted it into an engine, if it is loaded in a rails environment. I'm sure I've broken at least the requires for non-rails users.

If someone wants to help me, I forked at https://github.com/robotex82/ib-ruby. I'd prefer to have the changes pulled back, but I need help with the non-rails stuff.

Saludos,
Roberto

Member

arvicco commented May 10, 2012

Thanks for your contribution, Roberto. I looked into your fork, but I need to read up on Rails engines to understand what it is you're doing here and how to best merge it with non-Rails lib.

May I ask, if you do not have IB trading account, how do you intend to use this? AFAIK, it only works against IB account?

I don't have access to the paper trading account, it is being used by someone else.

Basically, a Railsengine is nothing very special. You need a rails engine class, and you have to follow some folder structure (Convention over configuration). That's the reason I had to change the folder structure.

Once you follow these conventions, basic inclusion of features (like models, controllers, views, generators,etc.) works automagically, by putting them in the right place.

A rails engine has the same structure as a rails application and rails, as it is an engine itself.

The first step could be to use the the IB:: namespace for the models instead of IB::Models and relocate them to /app/models instead of having them in /the lib folder.

Cheers,
Roberto

Member

ricpruss commented May 11, 2012

Hi Roboex82,
I pull your fork and had a look at where you are going and one thing I noticed is that you had to move things to conform to the rails conventions. Now I notice that the Engine documentation allows one to do the path mappings in the Engine definitions, so possibly we can do this without breaking all the existing test? Look at the Path section here.
http://edgeapi.rubyonrails.org/classes/Rails/Engine.html
Great to have someone else working on this, thanks for the contribution,
Ric

Member

arvicco commented Jul 18, 2012

Initial draft of Rails Engine now functional, instructions added to Readme, closing.

arvicco closed this Jul 18, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment