[Nitro] is Orderable weird exception
Aureliano Calvo
aurelianocalvo at yahoo.com.ar
Mon Jul 9 08:23:50 EDT 2007
> like before and like I explained already, Orderable as class can
> not be found so Og does some magic.
> Require the right file (og/model/orderable.rb) and it'll go away.
I've required the right file and this error went away but orderable is
not working :(.
It creates the position row in the database but it does not fill it.
Models:
class Question
attr_accessor :text, String
belongs_to :survey
is Orderable, :scope => :survey
end
class Survey
attr_accessor :name, String
has_many :questions , :list => true, :order => 'position DESC'
end
Offending spec:
describe Question, "new" do
before( :all ) do
@your_car = Survey.create_with( :name => "your car")
end
it "positions should be set" do
@like_your_car = Question.create_with( :text => "Do you like your car?")
@your_car.questions << like_your_car
@your_car_color = Question.create_with( :text => "What is the
color of your car?")
@your_car.questions << your_car_color
@like_your_car.position.should == 1 # position == null both here
and in the database.
@your_car_color.position.should == 2
end
after( :each ) do
Question.delete_all
end
after( :all ) do
Survey.delete_all
end
end
More information about the Nitro-general
mailing list