Firstly im new to Ruby and this could possibly be the wrong approach, however…
I’m trying to set two values in my select, using simple form. So far i have:
<%= f.input :rsvp, :collection => [:attending, :not_attending], :prompt => 'Choose one...' %>
This works fine, i can load the page, choose a selection. Now RSVP is a field in my db:
reply DB
class CreateReplies < ActiveRecord::Migration
def change
create_table :replies do |t|
t.string :name
t.text :menu
t.integer :rsvp
t.timestamps
end
end
end
reply.rb
class Reply < ActiveRecord::Base
attr_accessible :menu, :name, :rsvp, :user_id
belongs_to :user
end
My thinking was changing rsvp from :string where i have to type attending / not attending to an :integer so that i could yes likea true / false value on the two choices. Now like i said i’m very new to this, but in my head, this might be how to go about such a thing.
Because im going to try and get a count of how many are attending / not attending and display on the index. Sorry if anything is missing, let me know and ill update the question.
I think you went on the right way. You can make a group radio button for user select, try:
Or this way: