Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Question < ActiveRecord::Base
- belongs_to :bundle
- has_many :options
- has_many :votes
- end
- class Bundle < ActiveRecord::Base
- has_many :questions
- end
- BundlesController
- def show
- #check it exists first
- if Bundle.exists?(params[:id])
- @bundle = Bundle.find(params[:id])
- @question = @bundle.questions.first # because there is only one question in this test #### THIS IS ERROR HERE
- @options = @question.options
- logger.info(@bundle.id)
- logger.info(@question.text)
- @options.each do |o|
- logger.info(o.text)
- end
- respond_to do |format|
- format.html # show.html.erb
- format.xml { render :action => :show }
- end
- else
- respond_to do |format|
- format.html { redirect_to :index }
- format.xml { render :text => 'ERROR!' }
- end
- end
- end
Add Comment
Please, Sign In to add comment