Search code examples
iosrubygemsrubymotion

MotionMigrate error 'uninitialized constant MotionMigrate::MotionModel (NameError)


I tried using motion_migrate in my rubymotion app but I keep on getting this error when I run rake. I have included my rakefile, gemfile and my model file to help in debugging the problem

be rake

*** Terminating app due to uncaught exception 'NameError', reason: 'uninitialized constant MotionMigrate::MotionModel (NameError)'

My Rakefile

$:.unshift("/Library/RubyMotion/lib")

begin
  require 'motion/project/template/ios'
  require 'rubygems'
  require 'bundler'
  Bundler.require
  require 'motion-require'
  require 'motion_migrate'
  Motion::Require.all
rescue LoadError
end

Motion::Project::App.setup do |app|
  # Use `rake config' to see complete project settings.

  app.name = 'app'
  app.identifier = 'com.example.authexample'
  app.files = (app.files - Dir.glob('./app/**/*.rb')) + Dir.glob("./lib/**/*.rb") + Dir.glob("./config/**/*.rb") + Dir.glob("./app/**/*.rb")

  app.detect_dependencies = false
  #PODS
  app.pods do
    pod 'SVProgressHUD'
    pod 'SMPageControl'
  end
end

Also included my gemfile

source 'https://rubygems.org'

gem 'rake'
# Add your dependencies here:
gem "ProMotion", github: "clearsightstudio/ProMotion", branch: "edge"
gem 'bubble-wrap'
gem 'motion-cocoapods'
gem 'formotion'
gem 'sugarcube', :require => 'sugarcube-all'
gem 'motion-pixate'
gem 'ProMotion-formotion'
gem 'motion-support'
gem 'webstub'
gem 'afmotion'
gem 'motion_migrate'

Model

class User < MotionMigrate::Model
  property :username, :string 
  property :name,     :string 
  property :email,    :string 
end

Anyone have any idea what am doing wrong.

Thanks


Solution

  • I figured out what the problem was, it was a dependency issue. I forked the gem and included motion-require. This fixed the problem. https://github.com/gomezelom/motion_migrate