#804 hold

[PATCH] rails_datamapper get it to run with rails 2.3.0

Reported by kristian | February 22nd, 2009 @ 11:12 AM

rails_datamapper gave me a few problems: * Rails.root always gives an empty string * DataMapper.rake did not load the model files for automigrate/autoupgrade * the model generator did not generate my properties

the attached patch solves these little problems

Comments and changes to this ticket

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) April 17th, 2009 @ 02:31 AM

    • State changed from “unconfirmed” to “resolved”

    Thanks, this patch has been applied to dm-more/master and dm-more/next.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) April 17th, 2009 @ 11:49 AM

    @kristian: can you comment on some of the notes left in the commit:


  • Michael Klishin (antares)

    Michael Klishin (antares) April 18th, 2009 @ 09:58 AM

    I think DM Rails plugin must be 100% "free" from AR specific code, and not only because it lets you save on memory: less loaded code means less interdependencies that may break or interfere. Unless some members of the Rails community stops abusing aliasing and finally recalls Ruby is a damn pure OO language, less dependencies = less possible breakages.

    But of course, this may happen eventually and not next week. Agnosticism of Rails is a still largely a work in progress because minds do not change over night.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) April 18th, 2009 @ 04:47 PM

    The weird thing I can't understand from the patch is why ActiveRecord is require'd at all? If you really wanted AR, there's a configuration option you'd use to load it.

    This makes me think that either: a) there's some reason for it that is not obvious when viewing the code, or b) it was added as part of some other debugging that was happening, and kristian just forgot to remove it. I think "b" is the most likely case.

    If someone is using rails_datamapper with a Rails project, would you mind running some tests with this code taken out? If not, then I'll spin up a Rails project in the next week or so and give it a shot testing it. (I'm working like crazy trying to get dm-core 0.10 ready, or even close to ready, for RailsConf, otherwise I'd do it now myself)

  • Arthur Carlsson

    Arthur Carlsson April 20th, 2009 @ 07:21 AM

    I tried removing the require line from the generator but the generator would not work without it:

    arthur-carlssons-macbook-pro:appengine-test-app arthur$ jruby -S script/generate dm_model -p person

      exists  app/models/
      exists  test/unit/
      create  app/models/person.rb
      create  test/unit/person_test.rb
      exists  db/migrate

    uninitialized constant Rails::Generator::Commands::Base::ActiveRecord

    Does the ModelGenerator class have a dependency to ActiveRecord? I haven't checked it out...

    However, I don't think it's that big deal since it's just in the generator that this dependency exists. It won't affect the application in any other way.

  • tomjmalone (at gmail)

    tomjmalone (at gmail) April 20th, 2009 @ 07:24 AM

    The generator by default creates an active record migration, this is where the dependency is, we should probably just use the datamapper migrations, you can add the no migration switch to remove this dependency.

  • Arthur Carlsson

    Arthur Carlsson April 20th, 2009 @ 07:31 AM

    Ahh, ofcourse. After adding the --skip-migration option, the generator works as expected.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) April 20th, 2009 @ 11:08 AM

    • State changed from “resolved” to “accepted”

    Is there a way to make it so when using rails_datamapper the --skip-migration option is the default?

    Or alternatively, would it be possible to create a Rails::Generator::Commands::Base::DataMapper namespace, and copy it to Rails::Generator::Commands::Base::ActiveRecord when it doesn't exist? We could make it so that dm-migrations style migrations were generated instead of AR's.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) May 26th, 2010 @ 02:43 AM

    • State changed from “accepted” to “confirmed”
    • Assigned user changed from “tomjmalone (at gmail)” to “Martin Gamsjaeger (snusnu)”
  • Martin Gamsjaeger (snusnu)

    Martin Gamsjaeger (snusnu) October 24th, 2010 @ 07:33 AM

    • State changed from “confirmed” to “hold”
    • Assigned user cleared.
    • Milestone order changed from “0” to “0”

    Since I've got no experience using DM with rails-2.x and rails_datamapper, I'm unassigning myself from that ticket and put it on hold for now. If someone else still wants to take a stab, that's fine of course.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.