similar to: collection_check_boxes with has_many through: association Rails 4

Displaying 20 results from an estimated 2000 matches similar to: "collection_check_boxes with has_many through: association Rails 4"

2011 Jul 11
2
Pre-populating association
Hello, I think this is an easy one for the average Rails developer but I''m a bit stuck. I''m creating a simple voting app: any user can create a survey, with any number of questions, and other users can then vote by creating a ballot for that survey. Here''s the modeling: class Survey < ActiveRecord::Base has_many :questions has_many :eligibilities has_many
2006 Jul 07
0
has_many relation handling
Hello, please have a look at this: My tables: create_table :languages do |t| t.column :name, :string, :limit => 3 t.column :title, :string, :limit => 30 end create_table :categories do |t| t.column :category_id, :integer (3.) t.column :created_at, :timestamp t.column :updated_at, :timestamp end create_table :categorytranslations, :id
2006 Jul 06
0
radio_button with boolean fields does not work with postgresql
I don''t know what I am doing wrong. I have a User class with a "send_message_emails" boolean field. The value for this is true. In postgresql this is stored as a "t" in the database. In Rails this field is a boolean and is set to true, but for some reason the following code is *not* working... the radio_button is not selected. <%= radio_button "user",
2006 May 31
2
Storing a NULL value from a radio_button
Hi, I''ve a boolean database field (tinyint(1)) wich allows nulls. Then, I''ve something like this: radio_button(''server'',''customer_has_login'',"NULL") radio_button(''server'',''customer_has_login'',true) radio_button(''server'',''customer_has_login'',false) The problem is
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,
2008 Mar 23
1
radio buttons - how to identify record using value?
I''m making a simple questionnaire app using RoR. I''ve got a model for Questions, a model for Answers, and a third model, Qa, for matching each question to five possible answers through foreign keys. So, each qa has a question and five answers , a1-a5, through belongs_to and a :foreign_key, and then a selected_answer field for specifying which answer was selected by the user. The
2006 Apr 04
0
radio_button in a loop not working
Hi! I''m a RoR newbie and i''m trying to make this sample code work... I must be able to choose whether or not to switch lights on/off (one light per line) <table> <% @valeurs.each do |@v| %> <tr> <td>Light <%= Light.find(@v.light_id).nom %>:</td> <td><%= radio_button(''v[]'', ''etat'',
2009 Feb 21
3
belongs_to or has_many
2 tables Items and Categories Categories (id, name) Items (id, name, category_id) Category_id can be null, and there are Categories that has not an Item. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email
2010 May 19
1
Cannot have both select and radio_button together on the same form
Hello, I''m new to Ruby on Rails. I am creating a form for searching purpose: <% form_for :src_cond, :url => {:action =>''search''} do |p| %> <%= p.radio_button("bd", "1") %> a <%= p.radio_button("bd", "2") %> b <%= p.select :bd2, %w[1 2 3 4],{},{:index=>nil} %> <%=
2006 Apr 06
1
Puzzled by "radio_button".
I have what seems like simple, working code: <form action="save_dh_options" method="post"> <fieldset> <legend>DH Work Reports</legend> <p>Would you like to fill a work report?</p> <p><%= radio_button("user", "enable_report", "yes") %><label for="yes"> Yes</label><br
2006 Mar 22
2
Radio Button Defailt Value?
I have: <%= radio_button ''foo'', ''bar_id'', ''1'' %> <%= radio_button ''foo'', ''bar_id'', ''2'' %> <%= radio_button ''foo'', ''bar_id'', ''3'' %> I would like to have option #3 be selected if foo.bar_id is nil. Is there a way to do
2006 Jan 27
1
radio_button_tag quirkiness...
...or my ineptitude? I found that the following is always checking the last ''things'' button regardless of the value of query.table: People:<%= radio_button_tag("query", "table", "P") %> Animals:<%= radio_button_tag("query", "table", "A") %> Things:<%= radio_button_tag("query",
2006 Mar 10
0
Multiple radio buttons for defining multiple objects?
Hi, I''ve been working on a multiple choice Question/Answer system. The response object (analagous to a lineitem) has a question_id, user_id, and the actual response. What''s a good way of making a form with multiple response objects which are created from the radio_button helper? Right now I''ve got the following code:
2007 Jan 31
0
radio buttons => What if the value is a FK?
Hi: I have radio buttons like this in my view: <%= radio_button :goals, :goaltype_id, ''Recurring'', { :onclick => "new Effect.SlideDown(''recurring''); return false;" } %>&nbsp;&nbsp;Recurring<br /> <%= radio_button :goals, :goaltype_id, ''One-time'', { :onclick => "new
2006 Aug 10
3
Radio buttons refusing to load checked...
Hi, Having big problems with radio buttons that just don''t make sense: <%= radio_button "events", "impact_type", true %> Positive <%= radio_button "events", "impact_type", false %> Negative This should create two radio buttons with the first one checked by default, right? Cos it doesn''t :( Any ideas would be great, Thanks,
2006 Mar 01
1
observe_field question
I''m sure this is a simple problem, but I''ve been working on it for a couple days and can''t seem to figure out the correct way to structure my observe_field call. The HTML and Javascript generated all appear correct, but the AJAX call is never made. Below is the code I''m using and any help would be much appreciated. models_controller.rb def
2006 Jul 26
0
radio_button groups
For my first rails app, I''m building a web page that will list some restaurants and then have the user rate them from from 1 to 5 using 5 radio buttons. The view code looks like: <h3>Ratings:</h3> <form action="save_ratings" method="post"> <table> <tr> <th>Restaurant</th> <% for rating_option in
2007 Aug 04
0
capturing radio button values for nested object
I have a user object and an account object. User has one account object. In the signup.rhtml I have a radio button that has three options for the membership (yearly, monthly and sample). How do I populate the account model when the user submits the form? Is the following syntax correct? <%= radio_button("user[account]", "membership", "Yearly") %>
2009 Apr 28
0
Radio buttons in forms
<% form_for @group do |g| %> To create a new group please complete the details below <p> <label> Group Name </label> <%= g.text_field :name %> </p> <p> <label> Public </label> <%= g.radio_button :type, "public" %> <label> Private </label> <%=
2011 Nov 20
3
Use Ransack with radio buttons for boolean values
Hello I''m trying to search for active and non active users. These radio buttons work just fine except that it didn''t reselect itself after the form has been submitted. So, what should I do to ensure it will be selected just like how my text field populated automatically after the form has been submitted? = search_form_for @q do |f| = f.radio_button :is_active_false, 1 =