search for: survey_id

Displaying 7 results from an estimated 7 matches for "survey_id".

2011 Jul 11
2
Pre-populating association
...belongs_to :survey has_many :preferences end class Preference < ActiveRecord::Base belongs_to :ballot belongs_to :question end To be clear: a survey is the set of questions and a ballot is a voter''s set of answers (preferences). I''m using the nested route: /surveys/[:survey_id]/ballot/new for the voting page. What I''m having trouble with is pre-populating the ballot with empty preferences. When ballot/new is called, I do this: def new @survey = Survey.find(params[:survey_id]) @ballot = @survey.ballots.build # Prepare the ballot for qu...
2008 Sep 19
0
validates_uniqueness_of: passing a method to :scope
...cope option to a validates_uniqueness_of validation on a AR model? For example, I have nested models a bit like: class Survey has_many :areas end class Area belongs_to :survey has_many :questions, :order => ''position'' validates_uniqueness_of :position, :scope => : survey_id end class Question belongs_to :area validates_uniqueness_of :position, :scope => : area_id end So to get the questions on a survey, sorted by the ''survey_position'' attribute I have to add a foreign key to the question, so that I can pass the survey_id to the :scope argume...
2009 Jan 22
2
time date stamp since, january 1st 1970
...this time date stamp to a useable field in R, date and time in a data-frame. The developer says its the number of milliseconds since midnight, January 1, 1970. sample: *1232558018624* --------------------- How do I interpret the time stamp? Is there a date, i need a date and time. site_id,survey_id,version_id,survey_start_ts,survey_question_id,start_ts,end_ts,answer 2,registration,1,1232558018625,z1,*1232558018624*,*1232558266179*,4 Answer: The timestamp is a number representing the exact date and time. it is the number of milliseconds since midnight, January 1, 1970. Are you using it in...
2007 Sep 23
9
Code reviews: my dumb use of acts_as_commentable (newbie)
...for later, but ... should I? end def save_comment @comment = Comment.new # fine, I guess. @comment.title = params[:review][:new_comment_title] # seems complicated @comment.comment = params[:review][:new_comment_body] # ditto @review = Review.find(params[:review][:survey_id]) # from saved for later @review.add_comment(@comment) # fine redirect_to(:back) end Sure, it works, but there has to be a simpler way than defining comment-specific variables in my model, and subsequent references in my controller. What say ye, oh gods of Rails? Striketh me d...
2006 Jan 11
0
Limit attributes written out by to_yaml
...ng def Item.@attributes.to_yaml ? Does anyone have any ideas? Thanks image_alignment: '''' display_format: Vertical minimum_number_responses: item_sub_text: '''' page_number: 5 row_text_width: email_address_yn: N survey_id: 153 other_yn: N random_answer_order_yn: N database_dsn: '''' image_width: '''' other_display_type: subitem_count: answer_total: item_text: "<span style=\"font-weight:bold\">When a good has positiv...
2010 Nov 16
6
rails 3.0.3 and visit_CoercibleString errors
From having no errors with 3.0.2 I now see lots of these errors when running my tests. undefined method `visit_CoercibleString'' for #<Arel::Visitors::MySQL: 0x000001074f4298> Anyone know what this is? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2006 Jul 01
4
Radio_button in loop problem
Hi all, I can''t figure out why my radio_buttons won''t reflect the values stored in my database. I read through some of the previous posts -- is it true that they don''t work with integers? This is the code I''m using: <% for question in @survey.questions %> <%= debug question %> <%= radio_button ( "question", :question_id,