Created
October 5, 2011 23:58
-
-
Save marocchino/1266101 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#model | |
class Week < ActiveRecord::Base | |
def weeks=(weeks) | |
self.week = weeks.reject(&:blank?) * "," | |
end | |
def weeks | |
self.week.split(",") | |
end | |
end | |
<%# view %> | |
<h1>New week</h1> | |
<% form_for(@week) do |f| %> | |
<%= f.error_messages %> | |
<p><label for="week_name">Name</label><br/> | |
<%= text_field 'week', 'name' %></p> | |
<p><label for="week_week">week</label><br/> | |
<%= f.check_box( "weeks", {:multiple => true}, 1, nil) %>월 | |
<%= f.check_box( "weeks", {:multiple => true}, 2, nil) %>화 | |
<%= f.check_box( "weeks", {:multiple => true}, 3, nil) %>수 | |
<%= f.check_box( "weeks", {:multiple => true}, 4, nil) %>목 | |
<%= f.check_box( "weeks", {:multiple => true}, 5, nil) %>금 | |
<%= f.check_box( "weeks", {:multiple => true}, 6, nil) %>토 | |
<%= f.check_box( "weeks", {:multiple => true}, 7, nil) %>일 | |
<p> | |
<%= f.submit 'Create' %> | |
</p> | |
<% end %> | |
<%= link_to 'Back', weeks_path %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment