spik 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.rdoc CHANGED
@@ -8,15 +8,79 @@ The idea of this gem is experimenting with meta-programming abilities of Ruby. I
8
8
 
9
9
  Firstly I should tell you about syntax. It's not really recipe from all problems, but now we can tell something to Rails:
10
10
 
11
+ ### Model methods
12
+
13
+ 1. Execute scope method or model method with writing it in variable with generated name
14
+
15
+ ```ruby
16
+ # regular variant:
17
+ @scope_name_table_name = TableName.scope
18
+
19
+ # with Spik:
20
+ find scope_name [from] table_name
21
+ # or
22
+ scope_name [from] table_name
23
+ ```
24
+
25
+ for example with your table posts (and model Post with :popular scope):
26
+
27
+ ```ruby
28
+ # regular variant:
29
+ @popular_posts = Post.popular
30
+
31
+ # with Spik:
32
+ find popular posts
33
+ # or
34
+ popular posts
35
+ # or
36
+ find popular from posts
37
+ ```
38
+
39
+ 2. Execute scope method or model method with writing it in variable with custom name
40
+
41
+ ```ruby
42
+ # regular variant:
43
+ @custom_variable_name = TableName.scope
44
+
45
+ # with Spik:
46
+ find scope_name [from] table_name as custom_variable_name
47
+ # or
48
+ scope_name [from] table_name as custom_variable_name
49
+ ```
50
+
51
+ for example with your table posts (and model Post with :popular scope):
52
+
53
+ ```ruby
54
+ # regular variant:
55
+ @my_posts = Post.popular
56
+
57
+ # with Spik:
58
+ find popular posts as my_posts
59
+ # or
60
+ popular posts as 'my_posts'
61
+ # or
62
+ find popular from posts as my_posts
63
+ ```
64
+
65
+ ### Select
66
+
11
67
  1. Simple select from table:
12
68
 
13
69
  ```ruby
70
+ # regular variant:
71
+ @table_name = TableName.find(:all)
72
+
73
+ # with Spik:
14
74
  find all table_name
15
75
  ```
16
76
 
17
77
  for example with your table posts (and model Post):
18
78
 
19
79
  ```ruby
80
+ # regular variant:
81
+ @posts = Post.find(:all)
82
+
83
+ # with Spik:
20
84
  find all posts
21
85
  ```
22
86
 
@@ -25,12 +89,20 @@ Firstly I should tell you about syntax. It's not really recipe from all problems
25
89
  2. Select first row from your table:
26
90
 
27
91
  ```ruby
92
+ # regular variant:
93
+ @table_name_row = TableName.find(:first)
94
+
95
+ # with Spik:
28
96
  find first table_name_row
29
97
  ```
30
98
 
31
99
  for example with your table posts (and model Post):
32
100
 
33
101
  ```ruby
102
+ # regular variant:
103
+ @post = Post.find(:first)
104
+
105
+ # with Spik:
34
106
  find first post
35
107
  ```
36
108
 
@@ -39,12 +111,20 @@ Firstly I should tell you about syntax. It's not really recipe from all problems
39
111
  3. Select rows from table with some condition:
40
112
 
41
113
  ```ruby
42
- find all table_name (with|which has|which have) (attribute_name) (id as numeric|'string in quotes')
114
+ # regular variant:
115
+ @table_name = TableName.find(:all, :conditions => ['attribute = ?', value])
116
+
117
+ # with Spike:
118
+ find all table_name (with|which has|which have|who have|who has) (attribute_name) (id as numeric|'string in quotes')
43
119
  ```
44
120
 
45
121
  for example with your table posts (and model Post) and table has attribute title:
46
122
 
47
123
  ```ruby
124
+ # regular variant:
125
+ @posts = Post.find(:all, :conditions => ['title = ?', 'asdf'])
126
+
127
+ # with Spik:
48
128
  find all posts with title 'asdf'
49
129
  ```
50
130
 
@@ -53,12 +133,20 @@ Firstly I should tell you about syntax. It's not really recipe from all problems
53
133
  4. Select rows from table with new name of instance variable:
54
134
 
55
135
  ```ruby
56
- find all table_name as what_you_want_your_variable_name (with|which has|which have) (attribute_name) (id as numeric|'string in quotes')
136
+ # regular variant:
137
+ @what_you_want_your_variable_name = TableName.find(:all)
138
+
139
+ # with Spik:
140
+ find all table_name as what_you_want_your_variable_name (with|which has|which have|who have| who has) (attribute_name) (id as numeric|'string in quotes')
57
141
  ```
58
142
 
59
143
  for example with your table posts (and model Post) and table has attribute title:
60
144
 
61
145
  ```ruby
146
+ # regular variant:
147
+ @special_posts = Post.find(:all)
148
+
149
+ # with Spik:
62
150
  find all posts as special_posts
63
151
  ```
64
152
 
@@ -67,21 +155,77 @@ Firstly I should tell you about syntax. It's not really recipe from all problems
67
155
  5. Select rows from table with attribute like something:
68
156
 
69
157
  ```ruby
70
- find all table_name like attribute_name like 'something'
158
+ # regular variant:
159
+ @table_name = TableName.find(:all, :conditions => ['attribute LIKE "%?%"', value])
160
+
161
+ # with Spik:
162
+ find all table_name with attribute_name like 'something'
71
163
  ```
72
164
 
73
165
  for example with your table posts (and model Post) and table has attribute title:
74
166
 
75
167
  ```ruby
168
+ # regular variant:
169
+ @posts = Post.find(:all, :conditions => ['title LIKE "%?%"', 'asd'])
170
+
171
+ # with Spik:
76
172
  find all posts with title like 'asd'
77
173
  ```
78
174
 
79
175
  After this you have initiated instance variable in your controller @posts with items which have title like 'asd' (asdf|qweasdf|asd|...), and you can use it in your views and later in controller
80
176
 
81
- ## Older usage
177
+ ### Delete
178
+
179
+ 1. Delete all rows from table with attribute equals something:
180
+
181
+ ```ruby
182
+ # regular variant:
183
+ TableName.delete_all(['attribute = ?', value])
184
+
185
+ # with Spik:
186
+ delete all table_name with attribute_name 'something'
187
+ ```
188
+
189
+ for example with your table posts (and model Post) and table has attribute title:
190
+
191
+ ```ruby
192
+ # regular variant:
193
+ Post.delete_all(['title = ?', 'asd'])
194
+
195
+ # with Spik:
196
+ delete all posts with title 'asd'
197
+ ```
198
+
199
+ After this all posts rows with title 'asd' will be deleted
200
+
201
+ 2. Delete row from table with specific id:
202
+
203
+ ```ruby
204
+ # regular variant:
205
+ TableName.delete(id)
206
+
207
+ # with Spik:
208
+ delete [first] table_name_row with id (numeric)
209
+ ```
210
+
211
+ for example with your table posts (and model Post):
212
+
213
+ ```ruby
214
+ # regular variant:
215
+ Post.delete(5)
216
+
217
+ # with Spik:
218
+ delete post with id 5
219
+ ```
220
+
221
+ After this post row with id 5 will be deleted
222
+
223
+ ### Usage in project
82
224
 
83
225
  If you want to get all your posts, you just include Spik module in controller and write 'find all posts':
84
226
 
227
+ *app/controllers/home_controller.rb*
228
+
85
229
  ```ruby
86
230
  class HomeController < ApplicationController
87
231
  include Spik
@@ -99,6 +243,8 @@ end
99
243
 
100
244
  After that you can work with variables @post and @posts:
101
245
 
246
+ *app/views/home/index.html.erb*
247
+
102
248
  ```erb
103
249
  <h1>Hello Spik!</h1>
104
250
  <%- if @posts %>
@@ -114,13 +260,13 @@ After that you can work with variables @post and @posts:
114
260
  Puts this line into `Gemfile` then run `$ bundle`:
115
261
 
116
262
  ``` ruby
117
- gem 'spik', '0.0.1'
263
+ gem 'spik', '0.0.2'
118
264
  ```
119
265
 
120
266
  Or if you are old-school Rails 2 developer put this into `config/environment.rb` and run `$ rake gems:install`:
121
267
 
122
268
  ``` ruby
123
- config.gem 'spik', :version => '0.0.1'
269
+ config.gem 'spik', :version => '0.0.2'
124
270
  ```
125
271
 
126
272
  Or manually install spik gem: `$ gem install spik`
@@ -25,5 +25,14 @@ module Spik
25
25
  end
26
26
  end
27
27
  end
28
+
29
+ def execute_class_method(method, model_name, as_name = nil)
30
+ variable_name = '@' + method + '_' + model_name + 's'
31
+ variable_name = '@' + as_name.split('__').last if as_name
32
+
33
+ instance_variable_set(variable_name, model_name.capitalize.constantize.send(method))
34
+
35
+ variable_name
36
+ end
28
37
  end
29
38
  end
data/lib/spik/models.rb CHANGED
@@ -11,5 +11,14 @@ module Spik
11
11
  end
12
12
  end
13
13
  end
14
+
15
+ def class_methods
16
+ @class_method_names ||= {}.tap do |hash|
17
+ base_public_methods = ActiveRecord::Base.public_methods + [:original_table_name, :original_locking_column]
18
+ model_names.each do |model_name|
19
+ hash[model_name] = model_name.capitalize.constantize.public_methods - base_public_methods
20
+ end
21
+ end
22
+ end
14
23
  end
15
24
  end
data/lib/spik/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Spik
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/spik.rb CHANGED
@@ -35,9 +35,11 @@ module Spik
35
35
  else
36
36
  method + ' = ' + args[0].to_s
37
37
  end
38
+ elsif !class_methods.select{ |k,v| v.include? method.to_sym }.empty?
39
+ execute_class_method(method, args[0], args[1])
38
40
  elsif method == 'like'
39
41
  [method, args]
40
- elsif %w(with which has have).include? method
42
+ elsif %w(with which has have who from).include? method
41
43
  args.flatten
42
44
  elsif method == 'as'
43
45
  ['as__' + args[0], args[1..-1]]
@@ -2,6 +2,10 @@ class HomeController < ApplicationController
2
2
  include Spik
3
3
 
4
4
  def index
5
+ Rails.logger.info '********* here we find popular posts'
6
+ find popular posts
7
+ Rails.logger.info '********* here we find titles from posts as titled_posts'
8
+ find titles from posts as titled_posts
5
9
  Rails.logger.info '********* here we find post which has title like "asd" as asd_post'
6
10
  find first post as asd_post with title like 'f2'
7
11
  Rails.logger.info '********* here we find all posts and write it in variable special_posts!'
@@ -1,3 +1,8 @@
1
1
  class Post < ActiveRecord::Base
2
-
2
+ scope :titles, where(:title => 'asdf')
3
+ scope :popular, where(:title => 'asdf')
4
+
5
+ def self.all_titles
6
+ find(:all).map{|it| it.title}
7
+ end
3
8
  end
@@ -20,4 +20,16 @@
20
20
  <%- if @asd_post %>
21
21
  <p>asd_post</p>
22
22
  <%= @asd_post.title %>
23
+ <br/>
24
+ <br/>
25
+ <%- end %>
26
+ <%- if @popular_posts %>
27
+ <p>popular_posts</p>
28
+ <%= @popular_posts.size %>
29
+ <br/>
30
+ <br/>
31
+ <%- end %>
32
+ <%- if @titled_posts %>
33
+ <p>titled_posts</p>
34
+ <%= @titled_posts.size %>
23
35
  <%- end %>
@@ -1337,3 +1337,29 @@ Migrating to CreateNotices (20111022090628)
1337
1337
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
1338
1338
   (0.0ms) PRAGMA index_list("notices")
1339
1339
   (0.0ms) PRAGMA index_list("posts")
1340
+
1341
+
1342
+ Started GET "/" for 127.0.0.1 at 2011-10-26 22:09:10 +0700
1343
+ Processing by HomeController#index as HTML
1344
+ ********* here we find popular posts
1345
+ Completed 500 Internal Server Error in 1ms
1346
+
1347
+ NameError (uninitialized constant Posts):
1348
+ app/controllers/home_controller.rb:6:in `index'
1349
+
1350
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.5ms)
1351
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.0ms)
1352
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (9.1ms)
1353
+
1354
+
1355
+ Started GET "/" for 127.0.0.1 at 2011-10-26 22:10:51 +0700
1356
+ Processing by HomeController#index as HTML
1357
+ ********* here we find popular posts
1358
+ Completed 500 Internal Server Error in 1ms
1359
+
1360
+ NameError (uninitialized constant Posts):
1361
+ app/controllers/home_controller.rb:6:in `index'
1362
+
1363
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.5ms)
1364
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.0ms)
1365
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (4.9ms)
@@ -5370,3 +5370,208 @@ ActionController::RoutingError (No route matches [GET] "/favicon.ico"):
5370
5370
 
5371
5371
 
5372
5372
  Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.9ms)
5373
+
5374
+
5375
+ Started GET "/" for 127.0.0.1 at 2011-10-26 22:12:49 +0700
5376
+ Processing by HomeController#index as HTML
5377
+ ********* here we find popular posts
5378
+ Completed 500 Internal Server Error in 4ms
5379
+
5380
+ NoMethodError (undefined method `public_names' for #<Class:0x00000100a229b0>):
5381
+ app/controllers/home_controller.rb:6:in `index'
5382
+
5383
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)
5384
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.1ms)
5385
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (27.2ms)
5386
+
5387
+
5388
+ Started GET "/" for 127.0.0.1 at 2011-10-26 22:13:09 +0700
5389
+ Processing by HomeController#index as HTML
5390
+ ********* here we find popular posts
5391
+ Completed 404 Not Found in 14ms
5392
+
5393
+ ActiveRecord::RecordNotFound (Couldn't find Post with id=popular):
5394
+ app/controllers/home_controller.rb:6:in `index'
5395
+
5396
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)
5397
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.1ms)
5398
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (29.0ms)
5399
+
5400
+
5401
+ Started GET "/" for 127.0.0.1 at 2011-10-26 22:14:32 +0700
5402
+ Processing by HomeController#index as HTML
5403
+ ********* here we find popular posts
5404
+ ------!!!!----- posts ---- []
5405
+ ------!!!!----- popular ---- ["post"]
5406
+ ------!!!!----- find ---- ["popular", "post"]
5407
+ Completed 404 Not Found in 10ms
5408
+
5409
+ ActiveRecord::RecordNotFound (Couldn't find Post with id=popular):
5410
+ app/controllers/home_controller.rb:6:in `index'
5411
+
5412
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.5ms)
5413
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.1ms)
5414
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (27.4ms)
5415
+
5416
+
5417
+ Started GET "/" for 127.0.0.1 at 2011-10-26 22:15:11 +0700
5418
+ Processing by HomeController#index as HTML
5419
+ ********* here we find popular posts
5420
+ Completed 500 Internal Server Error in 2ms
5421
+
5422
+ SystemStackError (stack level too deep):
5423
+
5424
+
5425
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.4ms)
5426
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.1ms)
5427
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (6.3ms)
5428
+
5429
+
5430
+ Started GET "/" for 127.0.0.1 at 2011-10-26 22:15:30 +0700
5431
+ Processing by HomeController#index as HTML
5432
+ ********* here we find popular posts
5433
+ Completed 500 Internal Server Error in 2ms
5434
+
5435
+ TypeError (can't convert Hash into String):
5436
+ app/controllers/home_controller.rb:6:in `index'
5437
+
5438
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.6ms)
5439
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.0ms)
5440
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (6.7ms)
5441
+
5442
+
5443
+ Started GET "/" for 127.0.0.1 at 2011-10-26 22:15:42 +0700
5444
+ Processing by HomeController#index as HTML
5445
+ ********* here we find popular posts
5446
+ ------!!!!----- posts ---- [] === {"notice"=>[], "post"=>[:titles, :popular, :all_titles]}
5447
+ ------!!!!----- popular ---- ["post"] === {"notice"=>[], "post"=>[:titles, :popular, :all_titles]}
5448
+ ------!!!!----- find ---- ["popular", "post"] === {"notice"=>[], "post"=>[:titles, :popular, :all_titles]}
5449
+ Completed 404 Not Found in 10ms
5450
+
5451
+ ActiveRecord::RecordNotFound (Couldn't find Post with id=popular):
5452
+ app/controllers/home_controller.rb:6:in `index'
5453
+
5454
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.4ms)
5455
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.0ms)
5456
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (6.1ms)
5457
+
5458
+
5459
+ Started GET "/" for 127.0.0.1 at 2011-10-26 22:16:27 +0700
5460
+ Processing by HomeController#index as HTML
5461
+ ********* here we find popular posts
5462
+ ------!!!!----- posts ---- [] === {"notice"=>[], "post"=>[:titles, :popular, :all_titles]}
5463
+ ------!!!!----- popular ---- ["post"] === {"notice"=>[], "post"=>[:titles, :popular, :all_titles]}
5464
+ ------!!!!----- here we go! - popular --- ["post"]
5465
+ ------!!!!----- find ---- [" ------!!!!----- here we go! - popular --- [\"post\"]\n"] === {"notice"=>[], "post"=>[:titles, :popular, :all_titles]}
5466
+ Completed 500 Internal Server Error in 5ms
5467
+
5468
+ TypeError (can't convert nil into String):
5469
+ app/controllers/home_controller.rb:6:in `index'
5470
+
5471
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.5ms)
5472
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.1ms)
5473
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (7.2ms)
5474
+
5475
+
5476
+ Started GET "/" for 127.0.0.1 at 2011-10-26 22:23:27 +0700
5477
+ Processing by HomeController#index as HTML
5478
+ ********* here we find popular posts
5479
+ ------!!!!----- posts ---- [] === {"notice"=>[], "post"=>[:titles, :popular, :all_titles]}
5480
+ ------!!!!----- popular ---- ["post"] === {"notice"=>[], "post"=>[:titles, :popular, :all_titles]}
5481
+ ------!!!!----- find ---- [#<Post id: 3, title: "asdf", body: "1234123", created_at: "2011-10-22 14:29:52", updated_at: "2011-10-22 14:29:52">] === {"notice"=>[], "post"=>[:titles, :popular, :all_titles]}
5482
+ Completed 500 Internal Server Error in 13ms
5483
+
5484
+ TypeError (can't convert nil into String):
5485
+ app/controllers/home_controller.rb:6:in `index'
5486
+
5487
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.5ms)
5488
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.1ms)
5489
+ Rendered /Users/gazay/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (6.4ms)
5490
+
5491
+
5492
+ Started GET "/" for 127.0.0.1 at 2011-10-26 22:26:08 +0700
5493
+ Processing by HomeController#index as HTML
5494
+ ********* here we find popular posts
5495
+ ------!!!!----- posts ---- [] === {"notice"=>[], "post"=>[:titles, :popular, :all_titles]}
5496
+ ------!!!!----- popular ---- ["post"] === {"notice"=>[], "post"=>[:titles, :popular, :all_titles]}
5497
+ ------!!!!----- find ---- ["@popular_post"] === {"notice"=>[], "post"=>[:titles, :popular, :all_titles]}
5498
+ Rendered home/index.html.erb within layouts/application (2.1ms)
5499
+ Completed 200 OK in 17ms (Views: 12.6ms | ActiveRecord: 0.9ms)
5500
+
5501
+
5502
+ Started GET "/" for 127.0.0.1 at 2011-10-26 22:31:30 +0700
5503
+ Processing by HomeController#index as HTML
5504
+ ********* here we find popular posts
5505
+ ********* here we find titles from posts as titled_posts
5506
+ ********* here we find post which has title like "asd" as asd_post
5507
+ ********* here we find all posts and write it in variable special_posts!
5508
+ ********* here we find first post from all posts!
5509
+ ********* here we find all posts from all posts!
5510
+ ********* here we delete all posts with id 4
5511
+ ********* here we delete post with id 5
5512
+ Rendered home/index.html.erb within layouts/application (9.7ms)
5513
+ Completed 200 OK in 32ms (Views: 20.4ms | ActiveRecord: 4.6ms)
5514
+
5515
+
5516
+ Started GET "/" for 127.0.0.1 at 2011-10-26 22:32:41 +0700
5517
+ Processing by HomeController#index as HTML
5518
+ ********* here we find popular posts
5519
+ ----------!!!!!!--------- ["post"]
5520
+ ********* here we find titles from posts as titled_posts
5521
+ ----------!!!!!!--------- ["post", "as__titled_posts"]
5522
+ ********* here we find post which has title like "asd" as asd_post
5523
+ ********* here we find all posts and write it in variable special_posts!
5524
+ ********* here we find first post from all posts!
5525
+ ********* here we find all posts from all posts!
5526
+ ********* here we delete all posts with id 4
5527
+ ********* here we delete post with id 5
5528
+ Rendered home/index.html.erb within layouts/application (9.7ms)
5529
+ Completed 200 OK in 32ms (Views: 20.7ms | ActiveRecord: 4.4ms)
5530
+
5531
+
5532
+ Started GET "/" for 127.0.0.1 at 2011-10-26 22:33:14 +0700
5533
+ Processing by HomeController#index as HTML
5534
+ ********* here we find popular posts
5535
+ ----------!!!!!!--------- ["post"]
5536
+ ********* here we find titles from posts as titled_posts
5537
+ ----------!!!!!!--------- ["post", "as__titled_posts"]
5538
+ ********* here we find post which has title like "asd" as asd_post
5539
+ ********* here we find all posts and write it in variable special_posts!
5540
+ ********* here we find first post from all posts!
5541
+ ********* here we find all posts from all posts!
5542
+ ********* here we delete all posts with id 4
5543
+ ********* here we delete post with id 5
5544
+ Rendered home/index.html.erb within layouts/application (0.7ms)
5545
+ Completed 200 OK in 10ms (Views: 1.5ms | ActiveRecord: 3.9ms)
5546
+
5547
+
5548
+ Started GET "/" for 127.0.0.1 at 2011-10-26 22:33:41 +0700
5549
+ Processing by HomeController#index as HTML
5550
+ ********* here we find popular posts
5551
+ ----------!!!!!!--------- ["post"]
5552
+ @popular_posts
5553
+ ********* here we find titles from posts as titled_posts
5554
+ ----------!!!!!!--------- ["post", "as__titled_posts"]
5555
+ @as__titled_posts
5556
+ ********* here we find post which has title like "asd" as asd_post
5557
+ ********* here we find all posts and write it in variable special_posts!
5558
+ ********* here we find first post from all posts!
5559
+ ********* here we find all posts from all posts!
5560
+ ********* here we delete all posts with id 4
5561
+ ********* here we delete post with id 5
5562
+ Rendered home/index.html.erb within layouts/application (9.6ms)
5563
+ Completed 200 OK in 33ms (Views: 21.4ms | ActiveRecord: 4.9ms)
5564
+
5565
+
5566
+ Started GET "/" for 127.0.0.1 at 2011-10-26 22:34:31 +0700
5567
+ Processing by HomeController#index as HTML
5568
+ ********* here we find popular posts
5569
+ ********* here we find titles from posts as titled_posts
5570
+ ********* here we find post which has title like "asd" as asd_post
5571
+ ********* here we find all posts and write it in variable special_posts!
5572
+ ********* here we find first post from all posts!
5573
+ ********* here we find all posts from all posts!
5574
+ ********* here we delete all posts with id 4
5575
+ ********* here we delete post with id 5
5576
+ Rendered home/index.html.erb within layouts/application (9.9ms)
5577
+ Completed 200 OK in 32ms (Views: 20.4ms | ActiveRecord: 4.7ms)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spik
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,30 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-23 00:00:00.000000000 Z
13
- dependencies: []
12
+ date: 2011-10-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: &2153723280 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.1.1
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *2153723280
25
+ - !ruby/object:Gem::Dependency
26
+ name: sqlite3
27
+ requirement: &2153722860 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2153722860
14
36
  description: You can say something and controller understands you
15
37
  email:
16
38
  - alex.gaziev@gmail.com