Sequel ORM を使用しています
@latestorder = Step.where(:tutorial_id =>data['tutorial_id']).order(Sequel.desc(:order)).limit(1) #data['tutorial_id'] is 1
@neworder = @latestorder[:order] +1; #<-- this line causes errors!
NoMethodError at /makenew/stepundefined method `+' for #<Step:0x2f85138>
使用しても機能せず、このクエリ.to_i
には使用できません。DB[]
@latestorder と @latestorder[:order] の出力
<?r @latestorder.inspect ?>
#
<?r @latestorder.each do |late| ?>
#{late.inspect}
<?r end ?>
#13, :user_id=>1, :tutorial_id=>1, :order=>9, :title=>"グループを選択", :instruction=>"グループ ページから、グループの 1 つを選択して次に進みます。 \r\n\r\nflyasakiite のパスワードをお持ちの場合は、テスト目的で All About Compesh グループを選択してください", :url=">"http://compesh.com/groups", :datenumber="2012-11 -10", :datetimenumber="2012-11-10 13:18"}>
<?r @latestorder.each do |late| ?>
#{late.order.inspect}
<?r end ?>
9
.each
ループ内に入ることなく、LIMIT が 1 の @latestorder に 1 を追加できるようにする必要があります。