运行rake db:migrate:
时出现以下错误ArgumentError:未知密钥::订单。有效密钥是:: class_name, :anonymous_class,:foreign_key,:validate,:autosave,:table_name, :before_add,:after_add,:before_remove,:after_remove,:extend, :primary_key,:dependent,:as,:through,:source,:source_type, :inverse_of,:counter_cache,:join_table,:foreign_type
这是我收到错误的模型:
class Report < ActiveRecord::Base
belongs_to :user
has_many :icons, :order => 'position_id ASC' #showing error here..
has_many :photos, :dependent => :destroy
end
请帮忙。
答案 0 :(得分:12)
has_many :icons, -> { order('position_id ASC') }
答案 1 :(得分:1)
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: [package].app, PID: 19596
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:811)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jfree/graphics2d/svg/SVGGraphics2D;
at [package].[some.package].someMethod(Unknown)
at [package].app.MainActivity$SomeTask.doInBackground(MainActivity.java:67)
at [package].app.MainActivity$SomeTask.doInBackground(MainActivity.java:62)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:811)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.jfree.graphics2d.svg.SVGGraphics2D" on path: DexPathList[[zip file "/data/app/[package].app-2.apk"],nativeLibraryDirectories=[/data/app-lib/[package].app-2, /system/lib, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at [package].[some.package].someMethod(Unknown)
at [package].app.MainActivity$SomeTask.doInBackground(MainActivity.java:67)
at [package].app.MainActivity$SomeTask.doInBackground(MainActivity.java:62)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:811)
Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/Graphics2D;
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:222)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:215)
at dalvik.system.DexPathList.findClass(DexPathList.java:322)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
... 11 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "java.awt.Graphics2D" on path: DexPathList[[zip file "/data/app/[package].app-2.apk"],nativeLibraryDirectories=[/data/app-lib/[package].app-2, /system/lib, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
... 16 more
Suppressed: java.lang.ClassNotFoundException: java.awt.Graphics2D
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 17 more
Caused by: java.lang.NoClassDefFoundError: Class "Ljava/awt/Graphics2D;" not found
... 21 more
Suppressed: java.lang.ClassNotFoundException: org.jfree.graphics2d.svg.SVGGraphics2D
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 10 more
Caused by: java.lang.NoClassDefFoundError: Class "Lorg/jfree/graphics2d/svg/SVGGraphics2D;" not found
... 14 more