On Sun, Aug 17, 2014 at 5:53 PM, Bala Paranj <[email protected]> wrote:

> Since the dependency is on Rails framework, the right approach is to
> create a RailsEngine that you can share across your Rails applications not
> gem.
>
> Bala Paranj
> www.rubyplus.com
>
>
> On Friday, August 1, 2014 6:12:31 PM UTC-7, Ruby-Forum.com User wrote:
>>
>> I am creating an application using rails and spree at work.  One point
>> of value is the administrator being able to upload files that will seed
>> the database.
>>
>>
>> Our original solution was datashift_spree:
>> https://github.com/autotelik/datashift_spree
>>
>> Two problems arose.  1) apparently, the datashift bundle is 250 MB and
>> was hindering our deployment to heroku.  2) We couldn't figure out how
>> to use it from within a deployed application.
>>
>> After a few people spent a few days with these problems, I ended up just
>> writing the functionality myself ( no datashift at all ).  We have two
>> applications being developed, and the code is valuable to both.
>>
>> We would like to extract it, and the first thought was 'gem'.
>>
>> And thus the questions arise :)
>>
>> Assuming making a gem is the correct idea, I'm going to need to call
>> ActiveRecord methods such as 'create' from within the gem.  How do I
>> create or simulate a database that the gem can connect to?  When I do
>> get passed that question, how do I tell the gem to be able to 'know'
>> when it is just me testing it, and it being in a real rails environment?
>>
>

There's no reason a rails engine cannot be a gem. It starts out life that
way if you build it with rails anyway, since it creates a .gemspec file for
the engine.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAHUC_t9kxp%2B4bAAX7H5NGy0g_m9e373UFHwMnnBGniBBO50fNA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to