Created
April 2, 2014 20:16
-
-
Save sam452/9942221 to your computer and use it in GitHub Desktop.
ActionView::Template::Error: undefined method 'date' for Item
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
<%= simple_form_for @item do |f| %> | |
<%= f.input :category %> | |
<%= f.input :name %> | |
<%= f.input :sub_category %> | |
<%= f.input :explanation %> | |
<%= f.input :scoring %> | |
<%= f.input :high_score %> | |
<%= f.input :all_or_nothing, as: :boolean, checked_value: true, unchecked_value: false %> | |
<%= f.input :date, as: :boolean, checked_value: true, unchecked_value: false %> | |
<%= f.input :time, as: :boolean, checked_value: true, unchecked_value: false %> | |
<%= f.button :submit %> | |
<% end %> |
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
class AddDateToItems < ActiveRecord::Migration | |
def change | |
add_column :items, :date, :boolean | |
add_column :items, :time, :boolean | |
end | |
end |
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
require 'spec_helper' | |
feature "create items" do | |
background do | |
@attr = { | |
:name => "Cashiers are physically counting?", | |
:category => "Cash", | |
:sub_category => "Video Review", | |
:explanation => "Floors and aisles are clear", | |
:scoring => 7, | |
:high_score => 10, | |
:all_or_nothing => true, | |
:date => "1/1/2011", | |
:time => "4:59 PM" | |
} | |
SURVEY_OPTION = ["LP test Test", "number 2"] | |
end | |
context "in inspections" do | |
background do | |
@inspection = FactoryGirl.create(:inspection, site_id: @site.id, user_id: @VIP.id, survey_id: @survey.id) | |
end | |
scenario "can create an item" do | |
visit root_path | |
expect{ | |
click_link "New Item" | |
fill_in 'High score', with: @attr[:high_score] | |
check 'All or nothing', :checked | |
# check 'Date?', :checked | |
within(:css, "#item_date") do | |
check 'Date?', :checked | |
end | |
check 'Time?', :checked | |
save_and_open_page | |
click_button 'Create item' | |
}.to change(Item, :count).by(1) | |
end | |
end | |
end |
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
<div class="input boolean optional item_date"> | |
<input name="item[date]" type="hidden" value="false"> | |
<label class="boolean optional control-label checkbox" for="item_date"> | |
<input class="boolean optional" id="item_date" name="item[date]" type="checkbox" value="true"> | |
Date</label> | |
</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
create_table "items", force: true do |t| | |
t.string "category" | |
t.string "sub_category" | |
t.string "name" | |
t.string "explanation" | |
t.integer "scoring" | |
t.integer "high_score" | |
t.boolean "all_or_nothing" | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
t.integer "survey_id" | |
t.boolean "date" | |
t.boolean "time" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment