token_field 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +16 -5
- data/lib/token_field/engine.rb +4 -0
- data/lib/token_field/simple_form/token_input.rb +13 -0
- data/lib/token_field/version.rb +1 -1
- data/spec/dummy/app/controllers/items_controller.rb +31 -0
- data/spec/dummy/app/models/item.rb +5 -0
- data/spec/dummy/app/views/items/_form.html.erb +6 -0
- data/spec/dummy/app/views/items/edit.html.erb +2 -0
- data/spec/dummy/app/views/items/index.html.erb +9 -0
- data/spec/dummy/app/views/items/new.html.erb +2 -0
- data/spec/dummy/config/initializers/simple_form.rb +142 -0
- data/spec/dummy/config/locales/simple_form.en.yml +26 -0
- data/spec/dummy/config/routes.rb +1 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20121013214019_create_items.rb +10 -0
- data/spec/dummy/db/schema.rb +8 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/templates/erb/scaffold/_form.html.erb +13 -0
- data/spec/dummy/log/development.log +279 -0
- data/spec/dummy/log/test.log +1513 -0
- data/spec/dummy/tmp/cache/assets/C68/F70/sprockets%2F03000591510dc6784ee531c103e66a7a +0 -0
- data/spec/dummy/tmp/cache/assets/C82/490/sprockets%2F2cea86012965b76f28b56b4522099f12 +0 -0
- data/spec/dummy/tmp/cache/assets/CCB/5D0/sprockets%2F2b021b5261218f4183021778bade6ddd +0 -0
- data/spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/D0F/700/sprockets%2Fb728373cb12011fa141dfc9a8386ef89 +0 -0
- data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/D3E/1E0/sprockets%2Fd3e4a0e0e469d4f2099f2991fc52bd10 +0 -0
- data/spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/D7F/9E0/sprockets%2Fd984f45a60778c3cf14f1df92b0d9e6d +0 -0
- data/spec/dummy/tmp/cache/assets/DA5/100/sprockets%2F7d657d1d3bce59d08ee0cf74f16086ba +0 -0
- data/spec/dummy/tmp/cache/assets/DAC/370/sprockets%2F03a081dc7732cd2c4cbb10a57caa43ec +0 -0
- data/spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/factories/factories.rb +4 -0
- data/spec/requests/items_spec.rb +68 -0
- metadata +26 -5
- data/spec/dummy/tmp/pids/server.pid +0 -1
data/README.md
CHANGED
@@ -78,7 +78,7 @@ in routes we have route for token ajax call
|
|
78
78
|
then in view we call token_field with param :model => :category
|
79
79
|
|
80
80
|
<%= form_for @category do |f| %>
|
81
|
-
<%= f.token_field :parent_id, :model => :category %>
|
81
|
+
<%= f.token_field :parent_id, :model => :category, :token_url => token_categories_path %>
|
82
82
|
<% end %>
|
83
83
|
|
84
84
|
if there would be model Parent, we can omit :model parameter.
|
@@ -91,7 +91,7 @@ for example in Product model like this
|
|
91
91
|
we can use this code in view
|
92
92
|
|
93
93
|
<%= form_for @product do |f| %>
|
94
|
-
<%= f.token_field :category_id %>
|
94
|
+
<%= f.token_field :category_id, :token_url => token_categories_path %>
|
95
95
|
<% end %>
|
96
96
|
|
97
97
|
helper will allow you to enter only one element.
|
@@ -119,13 +119,13 @@ in view you will use attribute category_ids. token input will expected more than
|
|
119
119
|
so you can enter more than one category.
|
120
120
|
|
121
121
|
<%= form_for @product do |f| %>
|
122
|
-
<%= f.token_field :category_ids %>
|
122
|
+
<%= f.token_field :category_ids, :token_url => token_categories_path %>
|
123
123
|
<% end %>
|
124
124
|
|
125
125
|
if you want to use multiple token inputs on page, and id of element would be the same, you can user option :append_to_id.
|
126
126
|
|
127
127
|
<%= form_for @product do |f| %>
|
128
|
-
<%= f.token_field :category_ids, :append_to_id => :id %>
|
128
|
+
<%= f.token_field :category_ids, :token_url => token_categories_path, :append_to_id => :id %>
|
129
129
|
<% end %>
|
130
130
|
|
131
131
|
if @product.id is present and for example "3" it will use this id and generate id of html input like this "product_categories_ids_3"
|
@@ -134,11 +134,22 @@ if @product.id is nil id of html input will be "product_categories_ids"
|
|
134
134
|
other value for :append_id option will be used like this
|
135
135
|
|
136
136
|
<%= form_for @product do |f| %>
|
137
|
-
<%= f.token_field :category_ids, :append_to_id => 5 %>
|
137
|
+
<%= f.token_field :category_ids, :token_url => token_categories_path, :append_to_id => 5 %>
|
138
138
|
<% end %>
|
139
139
|
|
140
140
|
id of html input will be "product_categories_ids_5"
|
141
141
|
|
142
|
+
### SimpleForm support
|
143
|
+
|
144
|
+
if you use simple_form in your project, TokenInput field will be loaded.
|
145
|
+
you can use it in view like this
|
146
|
+
|
147
|
+
<%= simple_form_for(@item) do |f| %>
|
148
|
+
<%= f.input :category_id, :as => :token, :token_url => token_categories_path %>
|
149
|
+
<% end %>
|
150
|
+
|
151
|
+
all options for token_field helper can be used in simple form helper as well.
|
152
|
+
|
142
153
|
## Testing
|
143
154
|
|
144
155
|
add support for helpers in rspec
|
data/lib/token_field/engine.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "simple_form/inputs/base"
|
2
|
+
|
3
|
+
class TokenInput < SimpleForm::Inputs::Base
|
4
|
+
#
|
5
|
+
# one:
|
6
|
+
# <%= f.input :category_id, :as => :token %>
|
7
|
+
#
|
8
|
+
# many:
|
9
|
+
# <%= f.input :category_ids, :as => :token %>
|
10
|
+
def input
|
11
|
+
@builder.token_field(attribute_name, options)
|
12
|
+
end
|
13
|
+
end
|
data/lib/token_field/version.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
class ItemsController < ApplicationController
|
2
|
+
def index
|
3
|
+
@items = Item.all
|
4
|
+
end
|
5
|
+
|
6
|
+
def new
|
7
|
+
@item = Item.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def create
|
11
|
+
@item = Item.new(params[:item])
|
12
|
+
if @item.save
|
13
|
+
redirect_to items_path
|
14
|
+
else
|
15
|
+
render :new
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def edit
|
20
|
+
@item = Item.find(params[:id])
|
21
|
+
end
|
22
|
+
|
23
|
+
def update
|
24
|
+
@item = Item.find(params[:id])
|
25
|
+
if @item.update_attributes(params[:item])
|
26
|
+
redirect_to items_path
|
27
|
+
else
|
28
|
+
render :edit
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<h1>Items</h1>
|
2
|
+
<%= link_to "New", new_item_path %>
|
3
|
+
<ul>
|
4
|
+
<% @items.each do |item| %>
|
5
|
+
<%= content_tag_for(:li, item) do %>
|
6
|
+
<%= item.name %> - <%= item.category_id %> <%= link_to "Edit", edit_item_path(item), :id => dom_id(item) %>
|
7
|
+
<% end %>
|
8
|
+
<% end %>
|
9
|
+
</ul>
|
@@ -0,0 +1,142 @@
|
|
1
|
+
# Use this setup block to configure all options available in SimpleForm.
|
2
|
+
SimpleForm.setup do |config|
|
3
|
+
# Wrappers are used by the form builder to generate a
|
4
|
+
# complete input. You can remove any component from the
|
5
|
+
# wrapper, change the order or even add your own to the
|
6
|
+
# stack. The options given below are used to wrap the
|
7
|
+
# whole input.
|
8
|
+
config.wrappers :default, :class => :input,
|
9
|
+
:hint_class => :field_with_hint, :error_class => :field_with_errors do |b|
|
10
|
+
## Extensions enabled by default
|
11
|
+
# Any of these extensions can be disabled for a
|
12
|
+
# given input by passing: `f.input EXTENSION_NAME => false`.
|
13
|
+
# You can make any of these extensions optional by
|
14
|
+
# renaming `b.use` to `b.optional`.
|
15
|
+
|
16
|
+
# Determines whether to use HTML5 (:email, :url, ...)
|
17
|
+
# and required attributes
|
18
|
+
b.use :html5
|
19
|
+
|
20
|
+
# Calculates placeholders automatically from I18n
|
21
|
+
# You can also pass a string as f.input :placeholder => "Placeholder"
|
22
|
+
b.use :placeholder
|
23
|
+
|
24
|
+
## Optional extensions
|
25
|
+
# They are disabled unless you pass `f.input EXTENSION_NAME => :lookup`
|
26
|
+
# to the input. If so, they will retrieve the values from the model
|
27
|
+
# if any exists. If you want to enable the lookup for any of those
|
28
|
+
# extensions by default, you can change `b.optional` to `b.use`.
|
29
|
+
|
30
|
+
# Calculates maxlength from length validations for string inputs
|
31
|
+
b.optional :maxlength
|
32
|
+
|
33
|
+
# Calculates pattern from format validations for string inputs
|
34
|
+
b.optional :pattern
|
35
|
+
|
36
|
+
# Calculates min and max from length validations for numeric inputs
|
37
|
+
b.optional :min_max
|
38
|
+
|
39
|
+
# Calculates readonly automatically from readonly attributes
|
40
|
+
b.optional :readonly
|
41
|
+
|
42
|
+
## Inputs
|
43
|
+
b.use :label_input
|
44
|
+
b.use :hint, :wrap_with => { :tag => :span, :class => :hint }
|
45
|
+
b.use :error, :wrap_with => { :tag => :span, :class => :error }
|
46
|
+
end
|
47
|
+
|
48
|
+
# The default wrapper to be used by the FormBuilder.
|
49
|
+
config.default_wrapper = :default
|
50
|
+
|
51
|
+
# Define the way to render check boxes / radio buttons with labels.
|
52
|
+
# Defaults to :nested for bootstrap config.
|
53
|
+
# :inline => input + label
|
54
|
+
# :nested => label > input
|
55
|
+
config.boolean_style = :nested
|
56
|
+
|
57
|
+
# Default class for buttons
|
58
|
+
config.button_class = 'btn'
|
59
|
+
|
60
|
+
# Method used to tidy up errors. Specify any Rails Array method.
|
61
|
+
# :first lists the first message for each field.
|
62
|
+
# Use :to_sentence to list all errors for each field.
|
63
|
+
# config.error_method = :first
|
64
|
+
|
65
|
+
# Default tag used for error notification helper.
|
66
|
+
config.error_notification_tag = :div
|
67
|
+
|
68
|
+
# CSS class to add for error notification helper.
|
69
|
+
config.error_notification_class = 'alert alert-error'
|
70
|
+
|
71
|
+
# ID to add for error notification helper.
|
72
|
+
# config.error_notification_id = nil
|
73
|
+
|
74
|
+
# Series of attempts to detect a default label method for collection.
|
75
|
+
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
|
76
|
+
|
77
|
+
# Series of attempts to detect a default value method for collection.
|
78
|
+
# config.collection_value_methods = [ :id, :to_s ]
|
79
|
+
|
80
|
+
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
|
81
|
+
# config.collection_wrapper_tag = nil
|
82
|
+
|
83
|
+
# You can define the class to use on all collection wrappers. Defaulting to none.
|
84
|
+
# config.collection_wrapper_class = nil
|
85
|
+
|
86
|
+
# You can wrap each item in a collection of radio/check boxes with a tag,
|
87
|
+
# defaulting to :span. Please note that when using :boolean_style = :nested,
|
88
|
+
# SimpleForm will force this option to be a label.
|
89
|
+
# config.item_wrapper_tag = :span
|
90
|
+
|
91
|
+
# You can define a class to use in all item wrappers. Defaulting to none.
|
92
|
+
# config.item_wrapper_class = nil
|
93
|
+
|
94
|
+
# How the label text should be generated altogether with the required text.
|
95
|
+
# config.label_text = lambda { |label, required| "#{required} #{label}" }
|
96
|
+
|
97
|
+
# You can define the class to use on all labels. Default is nil.
|
98
|
+
config.label_class = 'control-label'
|
99
|
+
|
100
|
+
# You can define the class to use on all forms. Default is simple_form.
|
101
|
+
# config.form_class = :simple_form
|
102
|
+
|
103
|
+
# You can define which elements should obtain additional classes
|
104
|
+
# config.generate_additional_classes_for = [:wrapper, :label, :input]
|
105
|
+
|
106
|
+
# Whether attributes are required by default (or not). Default is true.
|
107
|
+
# config.required_by_default = true
|
108
|
+
|
109
|
+
# Tell browsers whether to use default HTML5 validations (novalidate option).
|
110
|
+
# Default is enabled.
|
111
|
+
config.browser_validations = false
|
112
|
+
|
113
|
+
# Collection of methods to detect if a file type was given.
|
114
|
+
# config.file_methods = [ :mounted_as, :file?, :public_filename ]
|
115
|
+
|
116
|
+
# Custom mappings for input types. This should be a hash containing a regexp
|
117
|
+
# to match as key, and the input type that will be used when the field name
|
118
|
+
# matches the regexp as value.
|
119
|
+
# config.input_mappings = { /count/ => :integer }
|
120
|
+
|
121
|
+
# Custom wrappers for input types. This should be a hash containing an input
|
122
|
+
# type as key and the wrapper that will be used for all inputs with specified type.
|
123
|
+
# config.wrapper_mappings = { :string => :prepend }
|
124
|
+
|
125
|
+
# Default priority for time_zone inputs.
|
126
|
+
# config.time_zone_priority = nil
|
127
|
+
|
128
|
+
# Default priority for country inputs.
|
129
|
+
# config.country_priority = nil
|
130
|
+
|
131
|
+
# Default size for text inputs.
|
132
|
+
# config.default_input_size = 50
|
133
|
+
|
134
|
+
# When false, do not use translations for labels.
|
135
|
+
# config.translate_labels = true
|
136
|
+
|
137
|
+
# Automatically discover new inputs in Rails' autoload path.
|
138
|
+
# config.inputs_discovery = true
|
139
|
+
|
140
|
+
# Cache SimpleForm inputs discovery
|
141
|
+
# config.cache_discovery = !Rails.env.development?
|
142
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
en:
|
2
|
+
simple_form:
|
3
|
+
"yes": 'Yes'
|
4
|
+
"no": 'No'
|
5
|
+
required:
|
6
|
+
text: 'required'
|
7
|
+
mark: '*'
|
8
|
+
# You can uncomment the line below if you need to overwrite the whole required html.
|
9
|
+
# When using html, text and mark won't be used.
|
10
|
+
# html: '<abbr title="required">*</abbr>'
|
11
|
+
error_notification:
|
12
|
+
default_message: "Please review the problems below:"
|
13
|
+
# Labels and hints examples
|
14
|
+
# labels:
|
15
|
+
# defaults:
|
16
|
+
# password: 'Password'
|
17
|
+
# user:
|
18
|
+
# new:
|
19
|
+
# email: 'E-mail to sign in.'
|
20
|
+
# edit:
|
21
|
+
# email: 'E-mail.'
|
22
|
+
# hints:
|
23
|
+
# defaults:
|
24
|
+
# username: 'User name to sign in.'
|
25
|
+
# password: 'No special characters, please.'
|
26
|
+
|
data/spec/dummy/config/routes.rb
CHANGED
Binary file
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20121013214019) do
|
15
15
|
|
16
16
|
create_table "categories", :force => true do |t|
|
17
17
|
t.string "name"
|
@@ -20,6 +20,13 @@ ActiveRecord::Schema.define(:version => 20121012235509) do
|
|
20
20
|
t.datetime "updated_at", :null => false
|
21
21
|
end
|
22
22
|
|
23
|
+
create_table "items", :force => true do |t|
|
24
|
+
t.string "name"
|
25
|
+
t.integer "category_id"
|
26
|
+
t.datetime "created_at", :null => false
|
27
|
+
t.datetime "updated_at", :null => false
|
28
|
+
end
|
29
|
+
|
23
30
|
create_table "product_has_categories", :force => true do |t|
|
24
31
|
t.integer "product_id"
|
25
32
|
t.integer "category_id"
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
|
2
|
+
<%%= f.error_notification %>
|
3
|
+
|
4
|
+
<div class="form-inputs">
|
5
|
+
<%- attributes.each do |attribute| -%>
|
6
|
+
<%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
|
7
|
+
<%- end -%>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="form-actions">
|
11
|
+
<%%= f.button :submit %>
|
12
|
+
</div>
|
13
|
+
<%% end %>
|
@@ -2846,3 +2846,282 @@ Served asset /application.js - 304 Not Modified (0ms)
|
|
2846
2846
|
|
2847
2847
|
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2012-10-13 12:36:31 +0200
|
2848
2848
|
Served asset /jquery.js - 304 Not Modified (0ms)
|
2849
|
+
Connecting to database specified by database.yml
|
2850
|
+
Connecting to database specified by database.yml
|
2851
|
+
[1m[36m (0.1ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
2852
|
+
Migrating to CreateCategories (20121012100526)
|
2853
|
+
Migrating to CreateProducts (20121012235444)
|
2854
|
+
Migrating to CreateProductHasCategories (20121012235509)
|
2855
|
+
Migrating to CreateItems (20121013214019)
|
2856
|
+
[1m[35m (0.0ms)[0m select sqlite_version(*)
|
2857
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
2858
|
+
[1m[35m (0.4ms)[0m CREATE TABLE "items" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "category_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
2859
|
+
[1m[36m (24.0ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ('20121013214019')[0m
|
2860
|
+
[1m[35m (12.1ms)[0m commit transaction
|
2861
|
+
[1m[36m (0.3ms)[0m [1mselect sqlite_version(*)[0m
|
2862
|
+
[1m[35m (0.1ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
2863
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("categories")[0m
|
2864
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("items")
|
2865
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("product_has_categories")[0m
|
2866
|
+
[1m[35m (0.0ms)[0m PRAGMA index_list("products")
|
2867
|
+
|
2868
|
+
|
2869
|
+
Started GET "/" for 127.0.0.1 at 2012-10-13 23:46:33 +0200
|
2870
|
+
Connecting to database specified by database.yml
|
2871
|
+
Processing by CategoriesController#index as HTML
|
2872
|
+
[1m[36mCategory Load (0.1ms)[0m [1mSELECT "categories".* FROM "categories" [0m
|
2873
|
+
Rendered categories/index.html.erb within layouts/application (5.5ms)
|
2874
|
+
Compiled token-input-facebook.css (0ms) (pid 3443)
|
2875
|
+
Compiled application.css (49ms) (pid 3443)
|
2876
|
+
Compiled jquery.js (4ms) (pid 3443)
|
2877
|
+
Compiled jquery_ujs.js (0ms) (pid 3443)
|
2878
|
+
Compiled jquery.tokeninput.js (0ms) (pid 3443)
|
2879
|
+
Compiled application.js (170ms) (pid 3443)
|
2880
|
+
Completed 200 OK in 505ms (Views: 454.5ms | ActiveRecord: 1.7ms)
|
2881
|
+
|
2882
|
+
|
2883
|
+
Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2012-10-13 23:46:34 +0200
|
2884
|
+
Served asset /application.css - 200 OK (3ms)
|
2885
|
+
|
2886
|
+
|
2887
|
+
Started GET "/assets/token-input-facebook.css?body=1" for 127.0.0.1 at 2012-10-13 23:46:34 +0200
|
2888
|
+
Served asset /token-input-facebook.css - 200 OK (1ms)
|
2889
|
+
|
2890
|
+
|
2891
|
+
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2012-10-13 23:46:34 +0200
|
2892
|
+
Served asset /jquery.js - 200 OK (3ms)
|
2893
|
+
|
2894
|
+
|
2895
|
+
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2012-10-13 23:46:34 +0200
|
2896
|
+
Served asset /jquery_ujs.js - 200 OK (1ms)
|
2897
|
+
|
2898
|
+
|
2899
|
+
Started GET "/assets/jquery.tokeninput.js?body=1" for 127.0.0.1 at 2012-10-13 23:46:34 +0200
|
2900
|
+
Served asset /jquery.tokeninput.js - 200 OK (1ms)
|
2901
|
+
|
2902
|
+
|
2903
|
+
Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2012-10-13 23:46:34 +0200
|
2904
|
+
Served asset /application.js - 200 OK (4ms)
|
2905
|
+
|
2906
|
+
|
2907
|
+
Started GET "/items" for 127.0.0.1 at 2012-10-13 23:46:39 +0200
|
2908
|
+
Processing by ItemsController#index as HTML
|
2909
|
+
[1m[35mItem Load (0.1ms)[0m SELECT "items".* FROM "items"
|
2910
|
+
Rendered items/index.html.erb within layouts/application (0.9ms)
|
2911
|
+
Completed 200 OK in 7ms (Views: 5.1ms | ActiveRecord: 0.3ms)
|
2912
|
+
|
2913
|
+
|
2914
|
+
Started GET "/items/new" for 127.0.0.1 at 2012-10-13 23:46:40 +0200
|
2915
|
+
Processing by ItemsController#new as HTML
|
2916
|
+
Rendered items/_form.html.erb (166.2ms)
|
2917
|
+
Rendered items/new.html.erb within layouts/application (194.1ms)
|
2918
|
+
Completed 500 Internal Server Error in 200ms
|
2919
|
+
|
2920
|
+
ActionView::Template::Error (No input found for token):
|
2921
|
+
1: <%= simple_form_for(@item) do |f| %>
|
2922
|
+
2: <%= f.input :name %>
|
2923
|
+
3: <%= f.input :category_ids, :as => :token, :token_url => token_categories_path %>
|
2924
|
+
4: <%= f.submit %>
|
2925
|
+
5: <% end %>
|
2926
|
+
6: <%= link_to "Listing", items_path %>
|
2927
|
+
app/views/items/_form.html.erb:3:in `block in _app_views_items__form_html_erb___1811428527127889752_2154073180'
|
2928
|
+
app/views/items/_form.html.erb:1:in `_app_views_items__form_html_erb___1811428527127889752_2154073180'
|
2929
|
+
app/views/items/new.html.erb:2:in `_app_views_items_new_html_erb__221201119574192906_2163567060'
|
2930
|
+
|
2931
|
+
|
2932
|
+
Rendered /Users/mirrec/.rvm/gems/ruby-1.9.3-head@wowbox/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.3ms)
|
2933
|
+
Rendered /Users/mirrec/.rvm/gems/ruby-1.9.3-head@wowbox/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.9ms)
|
2934
|
+
Rendered /Users/mirrec/.rvm/gems/ruby-1.9.3-head@wowbox/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (8.8ms)
|
2935
|
+
|
2936
|
+
|
2937
|
+
Started GET "/items/new" for 127.0.0.1 at 2012-10-13 23:56:41 +0200
|
2938
|
+
Connecting to database specified by database.yml
|
2939
|
+
Processing by ItemsController#new as HTML
|
2940
|
+
Rendered items/_form.html.erb (46.2ms)
|
2941
|
+
Rendered items/new.html.erb within layouts/application (50.4ms)
|
2942
|
+
Completed 500 Internal Server Error in 96ms
|
2943
|
+
|
2944
|
+
ActionView::Template::Error (undefined method `category_ids' for #<Item:0x00000101290390>):
|
2945
|
+
1: <%= simple_form_for(@item) do |f| %>
|
2946
|
+
2: <%= f.input :name %>
|
2947
|
+
3: <%= f.input :category_ids, :as => :token, :token_url => token_categories_path %>
|
2948
|
+
4: <%= f.submit %>
|
2949
|
+
5: <% end %>
|
2950
|
+
6: <%= link_to "Listing", items_path %>
|
2951
|
+
app/views/items/_form.html.erb:3:in `block in _app_views_items__form_html_erb___3681320351918761277_2156589100'
|
2952
|
+
app/views/items/_form.html.erb:1:in `_app_views_items__form_html_erb___3681320351918761277_2156589100'
|
2953
|
+
app/views/items/new.html.erb:2:in `_app_views_items_new_html_erb__2608424291861506679_2157462880'
|
2954
|
+
|
2955
|
+
|
2956
|
+
Rendered /Users/mirrec/.rvm/gems/ruby-1.9.3-head@wowbox/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.3ms)
|
2957
|
+
Rendered /Users/mirrec/.rvm/gems/ruby-1.9.3-head@wowbox/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.9ms)
|
2958
|
+
Rendered /Users/mirrec/.rvm/gems/ruby-1.9.3-head@wowbox/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (7.3ms)
|
2959
|
+
|
2960
|
+
|
2961
|
+
Started GET "/items/new" for 127.0.0.1 at 2012-10-13 23:57:48 +0200
|
2962
|
+
Processing by ItemsController#new as HTML
|
2963
|
+
Rendered items/_form.html.erb (56.4ms)
|
2964
|
+
Rendered items/new.html.erb within layouts/application (57.0ms)
|
2965
|
+
Completed 200 OK in 70ms (Views: 69.4ms | ActiveRecord: 0.0ms)
|
2966
|
+
|
2967
|
+
|
2968
|
+
Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2012-10-13 23:57:48 +0200
|
2969
|
+
Served asset /application.css - 304 Not Modified (3ms)
|
2970
|
+
|
2971
|
+
|
2972
|
+
Started GET "/assets/token-input-facebook.css?body=1" for 127.0.0.1 at 2012-10-13 23:57:48 +0200
|
2973
|
+
Served asset /token-input-facebook.css - 304 Not Modified (2ms)
|
2974
|
+
|
2975
|
+
|
2976
|
+
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2012-10-13 23:57:48 +0200
|
2977
|
+
Served asset /jquery.js - 304 Not Modified (5ms)
|
2978
|
+
|
2979
|
+
|
2980
|
+
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2012-10-13 23:57:48 +0200
|
2981
|
+
Served asset /jquery_ujs.js - 304 Not Modified (3ms)
|
2982
|
+
|
2983
|
+
|
2984
|
+
Started GET "/assets/jquery.tokeninput.js?body=1" for 127.0.0.1 at 2012-10-13 23:57:48 +0200
|
2985
|
+
Served asset /jquery.tokeninput.js - 304 Not Modified (1ms)
|
2986
|
+
|
2987
|
+
|
2988
|
+
Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2012-10-13 23:57:48 +0200
|
2989
|
+
Served asset /application.js - 304 Not Modified (6ms)
|
2990
|
+
|
2991
|
+
|
2992
|
+
Started GET "/categories/token?q=n" for 127.0.0.1 at 2012-10-13 23:57:53 +0200
|
2993
|
+
Processing by CategoriesController#token as JSON
|
2994
|
+
Parameters: {"q"=>"n"}
|
2995
|
+
[1m[36mCategory Load (0.1ms)[0m [1mSELECT "categories".* FROM "categories" WHERE (categories.name like '%n%')[0m
|
2996
|
+
Completed 200 OK in 21ms (Views: 0.3ms | ActiveRecord: 0.3ms)
|
2997
|
+
|
2998
|
+
|
2999
|
+
Started POST "/items" for 127.0.0.1 at 2012-10-13 23:57:57 +0200
|
3000
|
+
Processing by ItemsController#create as HTML
|
3001
|
+
Parameters: {"utf8"=>"✓", "authenticity_token"=>"lo/p4qjRmxTh+URMUOGsKBCYsotN3l+4gMF97lGTIFQ=", "item"=>{"name"=>"polozka", "category_id"=>"1"}, "commit"=>"Create Item"}
|
3002
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3003
|
+
[1m[36mSQL (43.1ms)[0m [1mINSERT INTO "items" ("category_id", "created_at", "name", "updated_at") VALUES (?, ?, ?, ?)[0m [["category_id", 1], ["created_at", Sat, 13 Oct 2012 21:57:57 UTC +00:00], ["name", "polozka"], ["updated_at", Sat, 13 Oct 2012 21:57:57 UTC +00:00]]
|
3004
|
+
[1m[35m (1.0ms)[0m commit transaction
|
3005
|
+
Redirected to http://localhost:3000/items
|
3006
|
+
Completed 302 Found in 47ms (ActiveRecord: 44.1ms)
|
3007
|
+
|
3008
|
+
|
3009
|
+
Started GET "/items" for 127.0.0.1 at 2012-10-13 23:57:57 +0200
|
3010
|
+
Processing by ItemsController#index as HTML
|
3011
|
+
[1m[36mItem Load (0.2ms)[0m [1mSELECT "items".* FROM "items" [0m
|
3012
|
+
Rendered items/index.html.erb within layouts/application (1.9ms)
|
3013
|
+
Completed 500 Internal Server Error in 5ms
|
3014
|
+
|
3015
|
+
ActionView::Template::Error (undefined method `category_ids' for #<Item:0x000001011212c0>):
|
3016
|
+
3: <ul>
|
3017
|
+
4: <% @items.each do |item| %>
|
3018
|
+
5: <%= content_tag_for(:li, item) do %>
|
3019
|
+
6: <%= item.name %> - <%= item.category_ids.inspect %> <%= link_to "Edit", edit_item_path(item), :id => dom_id(item) %>
|
3020
|
+
7: <% end %>
|
3021
|
+
8: <% end %>
|
3022
|
+
9: </ul>
|
3023
|
+
app/views/items/index.html.erb:6:in `block (2 levels) in _app_views_items_index_html_erb___1933584429465425982_2157446880'
|
3024
|
+
app/views/items/index.html.erb:5:in `block in _app_views_items_index_html_erb___1933584429465425982_2157446880'
|
3025
|
+
app/views/items/index.html.erb:4:in `each'
|
3026
|
+
app/views/items/index.html.erb:4:in `_app_views_items_index_html_erb___1933584429465425982_2157446880'
|
3027
|
+
|
3028
|
+
|
3029
|
+
Rendered /Users/mirrec/.rvm/gems/ruby-1.9.3-head@wowbox/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.1ms)
|
3030
|
+
Rendered /Users/mirrec/.rvm/gems/ruby-1.9.3-head@wowbox/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.8ms)
|
3031
|
+
Rendered /Users/mirrec/.rvm/gems/ruby-1.9.3-head@wowbox/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (6.6ms)
|
3032
|
+
|
3033
|
+
|
3034
|
+
Started GET "/items" for 127.0.0.1 at 2012-10-13 23:58:27 +0200
|
3035
|
+
Processing by ItemsController#index as HTML
|
3036
|
+
[1m[35mItem Load (0.1ms)[0m SELECT "items".* FROM "items"
|
3037
|
+
Rendered items/index.html.erb within layouts/application (1.4ms)
|
3038
|
+
Completed 200 OK in 6ms (Views: 5.4ms | ActiveRecord: 0.1ms)
|
3039
|
+
|
3040
|
+
|
3041
|
+
Started GET "/assets/token-input-facebook.css?body=1" for 127.0.0.1 at 2012-10-13 23:58:27 +0200
|
3042
|
+
Served asset /token-input-facebook.css - 304 Not Modified (0ms)
|
3043
|
+
|
3044
|
+
|
3045
|
+
Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2012-10-13 23:58:27 +0200
|
3046
|
+
Served asset /application.css - 304 Not Modified (0ms)
|
3047
|
+
|
3048
|
+
|
3049
|
+
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2012-10-13 23:58:27 +0200
|
3050
|
+
Served asset /jquery.js - 304 Not Modified (0ms)
|
3051
|
+
|
3052
|
+
|
3053
|
+
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2012-10-13 23:58:27 +0200
|
3054
|
+
Served asset /jquery_ujs.js - 304 Not Modified (0ms)
|
3055
|
+
|
3056
|
+
|
3057
|
+
Started GET "/assets/jquery.tokeninput.js?body=1" for 127.0.0.1 at 2012-10-13 23:58:27 +0200
|
3058
|
+
Served asset /jquery.tokeninput.js - 304 Not Modified (0ms)
|
3059
|
+
|
3060
|
+
|
3061
|
+
Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2012-10-13 23:58:27 +0200
|
3062
|
+
Served asset /application.js - 304 Not Modified (0ms)
|
3063
|
+
|
3064
|
+
|
3065
|
+
Started GET "/items/1/edit" for 127.0.0.1 at 2012-10-13 23:58:28 +0200
|
3066
|
+
Processing by ItemsController#edit as HTML
|
3067
|
+
Parameters: {"id"=>"1"}
|
3068
|
+
[1m[36mItem Load (0.2ms)[0m [1mSELECT "items".* FROM "items" WHERE "items"."id" = ? LIMIT 1[0m [["id", "1"]]
|
3069
|
+
[1m[35mCategory Load (0.2ms)[0m SELECT "categories".* FROM "categories" WHERE "categories"."id" = 1 LIMIT 1
|
3070
|
+
Rendered items/_form.html.erb (32.3ms)
|
3071
|
+
Rendered items/edit.html.erb within layouts/application (33.2ms)
|
3072
|
+
Completed 200 OK in 39ms (Views: 36.8ms | ActiveRecord: 0.4ms)
|
3073
|
+
|
3074
|
+
|
3075
|
+
Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2012-10-13 23:58:28 +0200
|
3076
|
+
Served asset /application.css - 304 Not Modified (0ms)
|
3077
|
+
|
3078
|
+
|
3079
|
+
Started GET "/assets/token-input-facebook.css?body=1" for 127.0.0.1 at 2012-10-13 23:58:28 +0200
|
3080
|
+
Served asset /token-input-facebook.css - 304 Not Modified (0ms)
|
3081
|
+
|
3082
|
+
|
3083
|
+
Started GET "/assets/jquery.tokeninput.js?body=1" for 127.0.0.1 at 2012-10-13 23:58:28 +0200
|
3084
|
+
Served asset /jquery.tokeninput.js - 304 Not Modified (0ms)
|
3085
|
+
|
3086
|
+
|
3087
|
+
Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2012-10-13 23:58:28 +0200
|
3088
|
+
Served asset /application.js - 304 Not Modified (0ms)
|
3089
|
+
|
3090
|
+
|
3091
|
+
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2012-10-13 23:58:28 +0200
|
3092
|
+
Served asset /jquery.js - 304 Not Modified (0ms)
|
3093
|
+
|
3094
|
+
|
3095
|
+
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2012-10-13 23:58:28 +0200
|
3096
|
+
Served asset /jquery_ujs.js - 304 Not Modified (0ms)
|
3097
|
+
|
3098
|
+
|
3099
|
+
Started GET "/items" for 127.0.0.1 at 2012-10-13 23:58:30 +0200
|
3100
|
+
Processing by ItemsController#index as HTML
|
3101
|
+
[1m[36mItem Load (0.1ms)[0m [1mSELECT "items".* FROM "items" [0m
|
3102
|
+
Rendered items/index.html.erb within layouts/application (0.7ms)
|
3103
|
+
Completed 200 OK in 5ms (Views: 4.4ms | ActiveRecord: 0.1ms)
|
3104
|
+
|
3105
|
+
|
3106
|
+
Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2012-10-13 23:58:30 +0200
|
3107
|
+
Served asset /application.css - 304 Not Modified (0ms)
|
3108
|
+
|
3109
|
+
|
3110
|
+
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2012-10-13 23:58:30 +0200
|
3111
|
+
Served asset /jquery.js - 304 Not Modified (0ms)
|
3112
|
+
|
3113
|
+
|
3114
|
+
Started GET "/assets/token-input-facebook.css?body=1" for 127.0.0.1 at 2012-10-13 23:58:30 +0200
|
3115
|
+
Served asset /token-input-facebook.css - 304 Not Modified (0ms)
|
3116
|
+
|
3117
|
+
|
3118
|
+
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2012-10-13 23:58:30 +0200
|
3119
|
+
Served asset /jquery_ujs.js - 304 Not Modified (0ms)
|
3120
|
+
|
3121
|
+
|
3122
|
+
Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2012-10-13 23:58:30 +0200
|
3123
|
+
Served asset /application.js - 304 Not Modified (0ms)
|
3124
|
+
|
3125
|
+
|
3126
|
+
Started GET "/assets/jquery.tokeninput.js?body=1" for 127.0.0.1 at 2012-10-13 23:58:30 +0200
|
3127
|
+
Served asset /jquery.tokeninput.js - 304 Not Modified (0ms)
|