stackoverfeeds 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +121 -0
  4. data/Rakefile +32 -0
  5. data/app/assets/javascripts/stackoverfeeds/application.js +13 -0
  6. data/app/assets/stylesheets/stackoverfeeds/application.css +13 -0
  7. data/app/controllers/stackoverfeeds/application_controller.rb +4 -0
  8. data/app/controllers/stackoverfeeds/so_feeds_controller.rb +10 -0
  9. data/app/helpers/stackoverfeeds/application_helper.rb +4 -0
  10. data/app/helpers/stackoverfeeds/stackoverfeeds_helper.rb +8 -0
  11. data/app/models/stackoverfeeds/so_feed.rb +9 -0
  12. data/app/views/stackoverfeeds/_stackoverflow_feeds.html.erb +28 -0
  13. data/app/views/stackoverfeeds/application.html.erb +14 -0
  14. data/config/routes.rb +3 -0
  15. data/db/migrate/20140402191249_create_stackoverfeeds_so_feeds.rb +14 -0
  16. data/lib/generators/stackoverfeeds/install/install_generator.rb +74 -0
  17. data/lib/generators/stackoverfeeds/install/templates/application.css +7 -0
  18. data/lib/generators/stackoverfeeds/install/templates/application.js +16 -0
  19. data/lib/generators/stackoverfeeds/install/templates/config.yml +14 -0
  20. data/lib/generators/stackoverfeeds/install/templates/feeds.css +791 -0
  21. data/lib/generators/stackoverfeeds/install/templates/feeds.js +21 -0
  22. data/lib/generators/stackoverfeeds/install/templates/schedule.rb +7 -0
  23. data/lib/generators/stackoverfeeds/install/templates/sprites.png +0 -0
  24. data/lib/stackoverfeeds.rb +4 -0
  25. data/lib/stackoverfeeds/engine.rb +11 -0
  26. data/lib/stackoverfeeds/stackoverfeeds_handler.rb +34 -0
  27. data/lib/stackoverfeeds/version.rb +3 -0
  28. data/lib/tasks/stackoverfeeds_tasks.rake +14 -0
  29. data/spec/dummy/README.rdoc +28 -0
  30. data/spec/dummy/Rakefile +6 -0
  31. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  32. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  33. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  34. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  35. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  36. data/spec/dummy/bin/bundle +3 -0
  37. data/spec/dummy/bin/rails +4 -0
  38. data/spec/dummy/bin/rake +4 -0
  39. data/spec/dummy/config.ru +4 -0
  40. data/spec/dummy/config/application.rb +28 -0
  41. data/spec/dummy/config/boot.rb +5 -0
  42. data/spec/dummy/config/database.yml +25 -0
  43. data/spec/dummy/config/environment.rb +5 -0
  44. data/spec/dummy/config/environments/development.rb +29 -0
  45. data/spec/dummy/config/environments/production.rb +80 -0
  46. data/spec/dummy/config/environments/test.rb +36 -0
  47. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  48. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  49. data/spec/dummy/config/initializers/inflections.rb +16 -0
  50. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  51. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  52. data/spec/dummy/config/initializers/session_store.rb +3 -0
  53. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  54. data/spec/dummy/config/locales/en.yml +23 -0
  55. data/spec/dummy/config/routes.rb +4 -0
  56. data/spec/dummy/db/development.sqlite3 +0 -0
  57. data/spec/dummy/db/migrate/20140403144550_create_stackoverfeeds_so_feeds.stackoverfeeds.rb +15 -0
  58. data/spec/dummy/db/schema.rb +27 -0
  59. data/spec/dummy/db/test.sqlite3 +0 -0
  60. data/spec/dummy/log/development.log +19 -0
  61. data/spec/dummy/log/test.log +772 -0
  62. data/spec/dummy/public/404.html +58 -0
  63. data/spec/dummy/public/422.html +58 -0
  64. data/spec/dummy/public/500.html +57 -0
  65. data/spec/dummy/public/favicon.ico +0 -0
  66. data/spec/dummy/spec/helpers/stackoverfeeds_spec.rb +20 -0
  67. data/spec/dummy/spec/lib/stackoverfeeds_handler_spec.rb +17 -0
  68. data/spec/dummy/spec/models/so_feed_spec.rb +32 -0
  69. data/spec/dummy/spec/resources/member.atom +243 -0
  70. data/spec/dummy/spec/spec_helper.rb +18 -0
  71. data/spec/dummy/spec/support/blueprints.rb +10 -0
  72. metadata +256 -0
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/404.html -->
52
+ <div class="dialog">
53
+ <h1>The page you were looking for doesn't exist.</h1>
54
+ <p>You may have mistyped the address or the page may have moved.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/422.html -->
52
+ <div class="dialog">
53
+ <h1>The change you wanted was rejected.</h1>
54
+ <p>Maybe you tried to change something you didn't have access to.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
File without changes
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+ require 'stackoverfeeds/stackoverfeeds_handler'
3
+
4
+ describe Stackoverfeeds::StackoverfeedsHelper do
5
+
6
+ describe 'stackoverflow_feeds' do
7
+
8
+ before :each do
9
+ link ="File://#{Rails.root}/spec/resources/member.atom"
10
+ StackoverfeedsHandler.fetch_and_create_feeds_enrties link
11
+ end
12
+
13
+ context 'check content correctness' do
14
+
15
+ it 'has to render partial stackoverflow_feeds with atom entries' do
16
+ expect(stackoverflow_feeds 20).to match /It makes only one query./
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+ require 'stackoverfeeds/stackoverfeeds_handler'
3
+
4
+ describe StackoverfeedsHandler do
5
+
6
+ describe '.fetch_and_create_feeds_enrties' do
7
+
8
+ let(:link) { "File://#{Rails.root}/spec/resources/member.atom" }
9
+
10
+ it 'has to fetch entries from feeds' do
11
+ expect{ StackoverfeedsHandler.fetch_and_create_feeds_enrties(link) }.to change{ Stackoverfeeds::SoFeed.count }.by(11)
12
+ end
13
+
14
+ end
15
+
16
+ end
17
+
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe Stackoverfeeds::SoFeed do
4
+
5
+ describe 'attributes' do
6
+ it { should respond_to :entry_id }
7
+ it { should respond_to :published }
8
+ it { should respond_to :updated }
9
+ it { should respond_to :title }
10
+ it { should respond_to :author }
11
+ it { should respond_to :summary }
12
+ end
13
+
14
+ describe 'methods' do
15
+ let(:feeds_entries) do
16
+ (1..12).each do
17
+ Stackoverfeeds::SoFeed.make!
18
+ end
19
+ end
20
+
21
+ it 'return the MAX permitted size even there are more (with parameter equals 5)' do
22
+ feeds_entries
23
+ expect(Stackoverfeeds::SoFeed.public_feeds(5).length).to eq(5)
24
+ end
25
+
26
+ it 'returns results in the correct order' do
27
+ feeds_entries
28
+ entry = Stackoverfeeds::SoFeed.make!(published: Time.now + 2.days)
29
+ expect(Stackoverfeeds::SoFeed.public_feeds.first.id).to eq(entry.id)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,243 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+
3
+ <feed xmlns="http://www.w3.org/2005/Atom" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:re="http://purl.org/atompub/rank/1.0">
4
+ <title type="text">User VAIRIX - Stack Overflow</title>
5
+ <link rel="self" href="http://stackoverflow.com/feeds/user/3470100" type="application/atom+xml" />
6
+ <link rel="alternate" href="http://stackoverflow.com/users/3470100" type="text/html" />
7
+ <subtitle>most recent 30 from stackoverflow.com</subtitle>
8
+ <updated>2014-04-02T17:00:30Z</updated>
9
+ <id>http://stackoverflow.com/feeds/user/3470100</id>
10
+ <creativeCommons:license>http://www.creativecommons.org/licenses/by-sa/3.0/rdf</creativeCommons:license>
11
+
12
+ <entry>
13
+ <id>http://stackoverflow.com/questions/22795691/-/22797446#22797446</id>
14
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
15
+ <title type="text">Answer by VAIRIX for Joining a table and a filtered table in ActiveRecord</title>
16
+ <author>
17
+ <name>VAIRIX</name>
18
+ <uri>http://stackoverflow.com/users/3470100</uri>
19
+ </author>
20
+ <link rel="alternate" href="http://stackoverflow.com/questions/22795691/joining-a-table-and-a-filtered-table-in-activerecord/22797446#22797446" />
21
+ <published>2014-04-01T21:41:35Z</published>
22
+ <updated>2014-04-01T21:41:35Z</updated>
23
+ <summary type="html">&lt;p&gt;You can do something like this:&lt;/p&gt;
24
+
25
+ &lt;pre&gt;&lt;code&gt;Song.joins(:albums).where(&#39;albums.released_on &amp;gt;= ?&#39;, from).where(&#39;albums.rating &amp;gt; ?&#39;, rating).where(&#39;albums.genre = ?&#39;, genres)
26
+ &lt;/code&gt;&lt;/pre&gt;
27
+
28
+ &lt;p&gt;It makes only one query.&lt;/p&gt;
29
+ </summary>
30
+ </entry>
31
+ <entry>
32
+ <id>http://stackoverflow.com/questions/22796203/in-rails-4-using-ajax-how-do-i-update-a-particular-div-on-success/22796990#22796990</id>
33
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
34
+ <title type="text">Answer by VAIRIX for In Rails 4 using AJAX, how do I update a particular div on success?</title>
35
+ <author>
36
+ <name>VAIRIX</name>
37
+ <uri>http://stackoverflow.com/users/3470100</uri>
38
+ </author>
39
+ <link rel="alternate" href="http://stackoverflow.com/questions/22796203/in-rails-4-using-ajax-how-do-i-update-a-particular-div-on-success/22796990#22796990" />
40
+ <published>2014-04-01T21:13:17Z</published>
41
+ <updated>2014-04-01T21:13:17Z</updated>
42
+ <summary type="html">&lt;p&gt;This should work for you:&lt;/p&gt;
43
+
44
+ &lt;pre&gt;&lt;code&gt;html = render_to_string(partial: &#39;images&#39;, locals: {user: user})
45
+ &lt;/code&gt;&lt;/pre&gt;
46
+ </summary>
47
+ </entry>
48
+ <entry>
49
+ <id>http://stackoverflow.com/questions/22761911/-/22762973#22762973</id>
50
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
51
+ <title type="text">Answer by VAIRIX for How to implement root route and get &quot;index&quot; to the same page</title>
52
+ <author>
53
+ <name>VAIRIX</name>
54
+ <uri>http://stackoverflow.com/users/3470100</uri>
55
+ </author>
56
+ <link rel="alternate" href="http://stackoverflow.com/questions/22761911/how-to-implement-root-route-and-get-index-to-the-same-page/22762973#22762973" />
57
+ <published>2014-03-31T13:34:39Z</published>
58
+ <updated>2014-03-31T13:34:39Z</updated>
59
+ <summary type="html">&lt;p&gt;A possible solution that implies more than one line, is using scope to make it cleaner, you will have two extra lines of code, but I found it more readable:&lt;/p&gt;
60
+
61
+ &lt;pre&gt;&lt;code&gt;scope :path =&amp;gt; &#39;/&#39;, :controller =&amp;gt; :static_pages do
62
+ get &#39;index&#39; =&amp;gt; :index, :as =&amp;gt; &#39;index&#39;
63
+ get &#39;home&#39; =&amp;gt; :index, :as =&amp;gt; &#39;home&#39;
64
+ end
65
+ &lt;/code&gt;&lt;/pre&gt;
66
+
67
+ &lt;p&gt;That way you make explicit which controller to use for all routes + the path (first part of it).&lt;/p&gt;
68
+ </summary>
69
+ </entry>
70
+ <entry>
71
+ <id>http://stackoverflow.com/questions/22762135/-/22762326#22762326</id>
72
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
73
+ <title type="text">Answer by VAIRIX for I don&#39;t really know what RSPEC assigns do, and my tests are failing</title>
74
+ <author>
75
+ <name>VAIRIX</name>
76
+ <uri>http://stackoverflow.com/users/3470100</uri>
77
+ </author>
78
+ <link rel="alternate" href="http://stackoverflow.com/questions/22762135/i-dont-really-know-what-rspec-assigns-do-and-my-tests-are-failing/22762326#22762326" />
79
+ <published>2014-03-31T13:05:05Z</published>
80
+ <updated>2014-03-31T13:05:05Z</updated>
81
+ <summary type="html">&lt;p&gt;What you should expect from the assign after calling your controller, is to have the value that the controller sets to the instance variable. You could see it like using @category. So the category created with FactoryGirl is not equals to the one created by your controller (in this case seems your action is returning nil value in your instance variable)&lt;/p&gt;
82
+ </summary>
83
+ </entry>
84
+ <entry>
85
+ <id>http://stackoverflow.com/questions/22720472/-/22720669#22720669</id>
86
+ <re:rank scheme="http://stackoverflow.com">1</re:rank>
87
+ <title type="text">Answer by VAIRIX for Select objects based on grandchild attribute with joins in ActiveRecord</title>
88
+ <author>
89
+ <name>VAIRIX</name>
90
+ <uri>http://stackoverflow.com/users/3470100</uri>
91
+ </author>
92
+ <link rel="alternate" href="http://stackoverflow.com/questions/22720472/select-objects-based-on-grandchild-attribute-with-joins-in-activerecord/22720669#22720669" />
93
+ <published>2014-03-28T18:35:10Z</published>
94
+ <updated>2014-03-28T18:35:10Z</updated>
95
+ <summary type="html">&lt;p&gt;This should be work!&lt;/p&gt;
96
+
97
+ &lt;pre&gt;&lt;code&gt;Foo.joins(:bazs).where(bazs: {name: &#39;x&#39;})
98
+ &lt;/code&gt;&lt;/pre&gt;
99
+ </summary>
100
+ </entry>
101
+ <entry>
102
+ <id>http://stackoverflow.com/questions/22717251/-/22717807#22717807</id>
103
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
104
+ <title type="text">Answer by VAIRIX for How can I display png data as an image inside in the browser?</title>
105
+ <author>
106
+ <name>VAIRIX</name>
107
+ <uri>http://stackoverflow.com/users/3470100</uri>
108
+ </author>
109
+ <link rel="alternate" href="http://stackoverflow.com/questions/22717251/how-can-i-display-png-data-as-an-image-inside-in-the-browser/22717807#22717807" />
110
+ <published>2014-03-28T16:04:58Z</published>
111
+ <updated>2014-03-28T16:04:58Z</updated>
112
+ <summary type="html">&lt;p&gt;One way to do this, is by doing the following:
113
+ In the view&lt;/p&gt;
114
+
115
+ &lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;/get_img/tlotr&quot;&amp;gt;
116
+ &lt;/code&gt;&lt;/pre&gt;
117
+
118
+ &lt;p&gt;That will make a request to the server, so in the routes.rb add&lt;/p&gt;
119
+
120
+ &lt;pre&gt;&lt;code&gt;get &#39;/get_img/:filename&#39; =&amp;gt; &#39;test#img&#39;
121
+ &lt;/code&gt;&lt;/pre&gt;
122
+
123
+ &lt;p&gt;In my case I have a TestController with an action call img like:&lt;/p&gt;
124
+
125
+ &lt;pre&gt;&lt;code&gt;def img
126
+ send_file( &quot;/your_path/#{params[:filename]}.png&quot;,
127
+ :disposition =&amp;gt; &#39;inline&#39;,
128
+ :type =&amp;gt; &#39;image/png&#39;,
129
+ :x_sendfile =&amp;gt; true )
130
+ end
131
+ &lt;/code&gt;&lt;/pre&gt;
132
+
133
+ &lt;p&gt;With this solution you hit the server one more time, but you don&#39;t have to send the data using the read method.&lt;/p&gt;
134
+ </summary>
135
+ </entry>
136
+ <entry>
137
+ <id>http://stackoverflow.com/questions/22716263/-/22716782#22716782</id>
138
+ <re:rank scheme="http://stackoverflow.com">0</re:rank>
139
+ <title type="text">Answer by VAIRIX for Use form to send ajax request to rails app</title>
140
+ <author>
141
+ <name>VAIRIX</name>
142
+ <uri>http://stackoverflow.com/users/3470100</uri>
143
+ </author>
144
+ <link rel="alternate" href="http://stackoverflow.com/questions/22716263/use-form-to-send-ajax-request-to-rails-app/22716782#22716782" />
145
+ <published>2014-03-28T15:20:09Z</published>
146
+ <updated>2014-03-28T15:20:09Z</updated>
147
+ <summary type="html">&lt;p&gt;You can do something like that:&lt;/p&gt;
148
+
149
+ &lt;p&gt;In your javascript file:&lt;/p&gt;
150
+
151
+ &lt;pre&gt;&lt;code&gt;$(&#39;#my_button&#39;).click(function(){
152
+ $.ajax({
153
+ type:&#39;GET&#39;,
154
+ url: &#39;/table&#39;,
155
+ data:{ rows: $(&#39;#my_text_field&#39;).val() },
156
+ success: function(data){
157
+ $(&#39;#my_table_container&#39;).html(data);
158
+ }
159
+ });
160
+ });
161
+ &lt;/code&gt;&lt;/pre&gt;
162
+
163
+ &lt;p&gt;In your controller:&lt;/p&gt;
164
+
165
+ &lt;pre&gt;&lt;code&gt;def table
166
+ render partial: &#39;table&#39;, locals: { rows: params[:rows] }
167
+ end
168
+ &lt;/code&gt;&lt;/pre&gt;
169
+
170
+ &lt;p&gt;In your routes.rb:&lt;/p&gt;
171
+
172
+ &lt;pre&gt;&lt;code&gt;match &#39;table&#39; =&amp;gt; &#39;your_controller#table&#39;
173
+ &lt;/code&gt;&lt;/pre&gt;
174
+
175
+ &lt;p&gt;And then in your partial (_partial.html.rb), you have to iterate over number of rows that you receive in the rows param. &lt;/p&gt;
176
+ </summary>
177
+ </entry>
178
+ <entry>
179
+ <id>http://stackoverflow.com/questions/22715588/-/22716096#22716096</id>
180
+ <re:rank scheme="http://stackoverflow.com">2</re:rank>
181
+ <title type="text">Answer by VAIRIX for Helper for controller and views</title>
182
+ <author>
183
+ <name>VAIRIX</name>
184
+ <uri>http://stackoverflow.com/users/3470100</uri>
185
+ </author>
186
+ <link rel="alternate" href="http://stackoverflow.com/questions/22715588/helper-for-controller-and-views/22716096#22716096" />
187
+ <published>2014-03-28T14:48:22Z</published>
188
+ <updated>2014-03-28T14:48:22Z</updated>
189
+ <summary type="html">&lt;p&gt;Define it in the ApplicationController like:&lt;/p&gt;
190
+
191
+ &lt;pre&gt;&lt;code&gt;class ApplicationController &amp;lt; ActionController::Base
192
+
193
+ helper_method :paypal_url
194
+
195
+ def paypal_url
196
+ &#39;https://www.paypal.com/cgi-bin/webscr&#39;
197
+ end
198
+
199
+ end
200
+ &lt;/code&gt;&lt;/pre&gt;
201
+
202
+ &lt;p&gt;After that you&#39;ll be able to use the helper method from any view or controller.&lt;/p&gt;
203
+ </summary>
204
+ </entry>
205
+ <entry>
206
+ <id>http://stackoverflow.com/questions/22761911/how-to-implement-root-route-and-get-index-to-the-same-page/22762973?cid=34709045#22762973</id>
207
+ <title type="text">Comment by VAIRIX on How to implement root route and get &quot;index&quot; to the same page</title>
208
+ <author>
209
+ <name>VAIRIX</name>
210
+ <uri>http://stackoverflow.com/users/3470100</uri>
211
+ </author>
212
+ <link rel="alternate" href="http://stackoverflow.com/questions/22761911/how-to-implement-root-route-and-get-index-to-the-same-page/22762973#22762973" />
213
+ <published>2014-03-31T16:45:30Z</published>
214
+ <updated>2014-03-31T16:45:30Z</updated>
215
+ <summary type="html">You can add &lt;code&gt;root to: &amp;#39;static_pages#index&amp;#39;&lt;/code&gt; inside or outside your scope. It&amp;#39;s a possible solution and maybe doesn&amp;#39;t fit what you expect, cause it takes more code to solve the problem.</summary>
216
+ </entry>
217
+
218
+ <entry>
219
+ <id>http://stackoverflow.com/questions/22759923/how-to-let-the-user-create-cron-jobs-in-rails?cid=34699568</id>
220
+ <title type="text">Comment by VAIRIX on How to let the user create cron jobs in rails?</title>
221
+ <author>
222
+ <name>VAIRIX</name>
223
+ <uri>http://stackoverflow.com/users/3470100</uri>
224
+ </author>
225
+ <link rel="alternate" href="http://stackoverflow.com/questions/22759923/how-to-let-the-user-create-cron-jobs-in-rails" />
226
+ <published>2014-03-31T12:58:30Z</published>
227
+ <updated>2014-03-31T12:58:30Z</updated>
228
+ <summary type="html">If you want to schedule a task every X period of time, and your user only sets when and the task (as you said), you could try doing it with delayedjob ` class.delay(run_at: 5.hours.from_now).method(param)` and call recursive in the method. Of course you will have some delay of excecution (even if the first thing in your method is calling the recursion). It should be some similar way to do it with Sidekiq (really don&amp;#39;t know). Be careful with overlapping of tasks.</summary>
229
+ </entry>
230
+
231
+ <entry>
232
+ <id>http://stackoverflow.com/questions/22716263/use-form-to-send-ajax-request-to-rails-app/22716782?cid=34623992#22716782</id>
233
+ <title type="text">Comment by VAIRIX on Use form to send ajax request to rails app</title>
234
+ <author>
235
+ <name>VAIRIX</name>
236
+ <uri>http://stackoverflow.com/users/3470100</uri>
237
+ </author>
238
+ <link rel="alternate" href="http://stackoverflow.com/questions/22716263/use-form-to-send-ajax-request-to-rails-app/22716782#22716782" />
239
+ <published>2014-03-28T17:57:47Z</published>
240
+ <updated>2014-03-28T17:57:47Z</updated>
241
+ <summary type="html">If you need more params from the view, just add them in the &amp;quot;data ajax attribute&amp;quot; like &lt;code&gt;data:{ rows: val1, sort: val2 }&lt;/code&gt;</summary>
242
+ </entry>
243
+ </feed>