This file contains 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
gnome-terminal --geometry=80x15 | |
#set vim tab width in ~/.vimrc | |
set ts=2 | |
set shiftwidth=2 | |
#apt-get stuff | |
10.04 | |
sudo apt-get install curl vim git-core build-essential libssl-dev libreadline5 libreadline5-dev zlib1g zlib1g-dev libzlib-ruby zlibc libopenssl-ruby bison libsqlite3-dev libssl-dev libxml2-dev libxslt-dev | |
12.04 |
This file contains 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
ruby-1.9.2-head :001 > t = Template.first | |
=> #<Template id: 1, name: "Computer Tech Template", created_at: "2011-11-22 18:38:45", updated_at: "2011-11-22 18:38:45"> | |
r = Rubric.new(t.attributes.merge(:name => t.name, :created_at => t.created_at)) | |
=> #<Rubric id: nil, name: "Computer Tech Template", section_id: nil, created_at: "2011-11-22 18:38:45", updated_at: "2011-11-22 18:38:45", competency: nil> | |
This file contains 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
Loading development environment (Rails 3.0.5) | |
ruby-1.9.2-head :001 > r = Rubric.first | |
=> #<Rubric id: 1, name: "Computer Technology", section_id: 2, created_at: "2011-10-18 13:53:24", updated_at: "2011-11-23 19:33:24", competency: ""> | |
ruby-1.9.2-head :002 > r.indicators | |
=> [#<Indicator id: 1, rubric_id: 1, name: "Present info professionally", created_at: "2011-10-18 13:53:24", updated_at: "2011-10-18 13:53:24">, #<Indicator id: 6, rubric_id: 1, name: "test2", created_at: "2011-11-23 19:33:24", updated_at: "2011-11-23 19:33:24">] | |
ruby-1.9.2-head :003 > r.questions | |
=> [#<Question id: 1, indicator_id: 1, name: "Choosed the correct software", created_at: "2011-10-18 13:53:24", updated_at: "2011-10-18 13:53:24">, #<Question id: 7, indicator_id: 1, name: "test", created_at: "2011-11-23 19:33:24", updated_at: "2011-11-23 19:33:24">, #<Question id: 8, indicator_id: 6, name: "q2", created_at: "2011-11-23 19:33:24", updated_at: "2011-11-23 19:33:24">] | |
ruby-1.9.2-head :004 > klone = r.clone :include => {:indicator |
This file contains 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
<%= form_for @rubric do |f| %> | |
<%= f.error_messages %> | |
<p> | |
<%= f.label :name %><br /> | |
<%= f.text_field :name %> | |
</p> | |
<p> | |
<%= f.label :competency %><br /> | |
<%= f.text_field :competency, :size => 50 %> | |
</p> |
This file contains 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
#User model | |
class User < ActiveRecord::Base | |
belongs_to :organization | |
accepts_nested_attributes_for :organization | |
# Include default devise modules. Others available are: | |
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable | |
devise :database_authenticatable, :registerable, | |
:recoverable, :rememberable, :trackable, :validatable |
This file contains 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
<h2>Sign up</h2> | |
<% resource.organization ||= Organization.new %> | |
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %> | |
<%= devise_error_messages! %> | |
<div><%= f.label :email %><br /> | |
<%= f.email_field :email %></div> | |
<%= f.fields_for :organization do |organization_form| %> | |
<div><%= organization_form.label :name %><br /> | |
<%= organization_form.text_field :name %></div> |
This file contains 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
<h2>Sign up</h2> | |
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %> | |
<%= devise_error_messages! %> | |
<input type="text" name="user[organization_attributes][name]"> | |
<div><%= f.label :email %><br /> | |
<%= f.email_field :email %></div> | |
<div><%= f.label :password %><br /> | |
<input type="text" name="user[organization_attributes][name]"> | |
<% user = User.new(:organization => Organization.new) %> |
This file contains 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
<%= submit_tag 'Submit', :onclick => 'return validate(this)' %><br/> | |
<script type="text/javascript" charset="utf-8"> | |
function validate() { | |
var valid = false; | |
var radio_groups = {} | |
$(":radio").each(function(){ | |
radio_groups[this.name] = true; | |
}) | |
for(group in radio_groups){ |
This file contains 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
<tr> | |
<td>Choosed the correct software | |
(Present info professionally)</td> | |
<input id="results_0_question_id" name="results[0][question_id]" type="hidden" value="3" /> | |
<input id="results_0_student_id" name="results[0][student_id]" type="hidden" value="68" /> | |
<td><input id="results_0_score_0" name="results[0][score]" type="radio" value="0" /></td> | |
<td><input id="results_0_score_1" name="results[0][score]" type="radio" value="1" /></td> | |
<td><input id="results_0_score_2" name="results[0][score]" type="radio" value="2" /></td> | |
<td><input id="results_0_score_3" name="results[0][score]" type="radio" value="3" /></td> |
This file contains 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
#controller | |
def new | |
@questions = Array.new(3) {Question.new} | |
respond_to do |format| | |
format.html # new.html.erb | |
format.xml { render :xml => @question } | |
end | |
end | |
def create | |
@questions = params[:questions].values.collect { |question| Question.new(question) } |