rusty_engine 0.0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/rusty_engine/recentmessage.js +2 -0
- data/app/assets/stylesheets/rusty_engine/recentmessage.css +4 -0
- data/app/controllers/rusty_engine/recentmessage_controller.rb +18 -0
- data/app/helpers/rusty_engine/recentmessage_helper.rb +4 -0
- data/app/models/rusty_engine/recentmessages.rb +11 -0
- data/app/views/layouts/rusty_engine/application.html.erb +1 -1
- data/app/views/rusty_engine/recentmessage/index.html.erb +15 -0
- data/config/routes.rb +4 -2
- data/db/migrate/20170616193639_create_rusty_engine_recentmessages.rb +8 -0
- data/test/controllers/rusty_engine/recentmessage_controller_test.rb +16 -0
- data/test/dummy/log/development.log +101 -0
- data/test/dummy/log/test.log +8 -0
- data/test/fixtures/rusty_engine/recentmessages.yml +11 -0
- data/test/helpers/rusty_engine/recentmessage_helper_test.rb +6 -0
- data/test/models/rusty_engine/recentmessages_test.rb +9 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcb6ba3c5cfed21ef661b2c8e628ca72e51fc430
|
4
|
+
data.tar.gz: e646e1522e70b23264074d2f4e4451c8ec1a5f5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3feb835ec0a537f9beb45124a7294435784deb2a0846960898d8c9986ef88fe9962f7f2f8808c48205b707f0541b150e2e466c2b9a0aece26e9a7e7163030406
|
7
|
+
data.tar.gz: 0b144bb0970ad00eb1da21a7e233a4ea40054146d87a7a54929033c3d2030c9e59c319f9e4ab077eab87a7bb9fdc711e5693b21ca70f6d58549e1cad7bb116ac
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_dependency "rusty_engine/application_controller"
|
2
|
+
|
3
|
+
module RustyEngine
|
4
|
+
class ApplicationController < ::ApplicationController
|
5
|
+
def index
|
6
|
+
if session[:user_id] = user.id
|
7
|
+
@conversation = Conversation.find(params[:conversation_last])
|
8
|
+
@messages = @conversation.messages
|
9
|
+
i = 0
|
10
|
+
begin
|
11
|
+
@messages[i]
|
12
|
+
i += 1
|
13
|
+
end until i > 2
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module RustyEngine
|
2
|
+
class Recentmessages < ActiveRecord::Base
|
3
|
+
belongs_to :user
|
4
|
+
has_many :messages, dependent :destroy
|
5
|
+
|
6
|
+
def recent_message
|
7
|
+
scope :between, -> (sender_id, recipient_id) do
|
8
|
+
where("conversations.sender_id = ? OR conversations.recipient_id = ?", sender_id, recipient_id)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div class="ui segment">
|
2
|
+
<h3>Recent Messages</h3>
|
3
|
+
<div class="ui list">
|
4
|
+
<div class="item">
|
5
|
+
<% @conversations.each do |conversation| %>
|
6
|
+
<% if conversation.sender_id == current_user.id || conversation.recipient_id == current_user.id %>
|
7
|
+
<% if conversation.sender_id == current_user.id %>
|
8
|
+
<% recipient = User.find(conversation.recipient_id) %>
|
9
|
+
<% else %>
|
10
|
+
<% recipient = User.find(coversation.send_id) %>
|
11
|
+
<% end %>
|
12
|
+
<% recipient.first_name, conversation.display %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</div>
|
data/config/routes.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module RustyEngine
|
4
|
+
class RecentmessageControllerTest < ActionController::TestCase
|
5
|
+
test "should get new" do
|
6
|
+
get :new
|
7
|
+
assert_response :success
|
8
|
+
end
|
9
|
+
|
10
|
+
test "should get create" do
|
11
|
+
get :create
|
12
|
+
assert_response :success
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -16,3 +16,104 @@ Started GET "/" for 127.0.0.1 at 2017-06-16 10:59:01 -0400
|
|
16
16
|
Processing by Rails::WelcomeController#index as HTML
|
17
17
|
Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (2.3ms)
|
18
18
|
Completed 200 OK in 11ms (Views: 10.9ms | ActiveRecord: 0.0ms)
|
19
|
+
|
20
|
+
|
21
|
+
Started GET "/" for 127.0.0.1 at 2017-06-19 09:36:23 -0400
|
22
|
+
Processing by Rails::WelcomeController#index as HTML
|
23
|
+
Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (3.0ms)
|
24
|
+
Completed 200 OK in 136ms (Views: 135.6ms | ActiveRecord: 0.0ms)
|
25
|
+
|
26
|
+
|
27
|
+
Started GET "/" for 127.0.0.1 at 2017-06-19 09:36:23 -0400
|
28
|
+
Processing by Rails::WelcomeController#index as HTML
|
29
|
+
Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (0.1ms)
|
30
|
+
Completed 200 OK in 2ms (Views: 2.3ms | ActiveRecord: 0.0ms)
|
31
|
+
|
32
|
+
|
33
|
+
Started GET "/" for 127.0.0.1 at 2017-06-19 11:49:44 -0400
|
34
|
+
Processing by Rails::WelcomeController#index as HTML
|
35
|
+
Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (2.0ms)
|
36
|
+
Completed 200 OK in 10ms (Views: 9.5ms | ActiveRecord: 0.0ms)
|
37
|
+
|
38
|
+
|
39
|
+
Started GET "/conversations/1/messages" for 127.0.0.1 at 2017-06-19 11:49:45 -0400
|
40
|
+
|
41
|
+
ActionController::RoutingError (No route matches [GET] "/conversations/1/messages"):
|
42
|
+
actionpack (4.1.16) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
|
43
|
+
actionpack (4.1.16) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
|
44
|
+
railties (4.1.16) lib/rails/rack/logger.rb:38:in `call_app'
|
45
|
+
railties (4.1.16) lib/rails/rack/logger.rb:20:in `block in call'
|
46
|
+
activesupport (4.1.16) lib/active_support/tagged_logging.rb:68:in `block in tagged'
|
47
|
+
activesupport (4.1.16) lib/active_support/tagged_logging.rb:26:in `tagged'
|
48
|
+
activesupport (4.1.16) lib/active_support/tagged_logging.rb:68:in `tagged'
|
49
|
+
railties (4.1.16) lib/rails/rack/logger.rb:20:in `call'
|
50
|
+
actionpack (4.1.16) lib/action_dispatch/middleware/request_id.rb:21:in `call'
|
51
|
+
rack (1.5.5) lib/rack/methodoverride.rb:21:in `call'
|
52
|
+
rack (1.5.5) lib/rack/runtime.rb:17:in `call'
|
53
|
+
activesupport (4.1.16) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
|
54
|
+
rack (1.5.5) lib/rack/lock.rb:17:in `call'
|
55
|
+
actionpack (4.1.16) lib/action_dispatch/middleware/static.rb:84:in `call'
|
56
|
+
rack (1.5.5) lib/rack/sendfile.rb:112:in `call'
|
57
|
+
railties (4.1.16) lib/rails/engine.rb:514:in `call'
|
58
|
+
railties (4.1.16) lib/rails/application.rb:144:in `call'
|
59
|
+
rack (1.5.5) lib/rack/lock.rb:17:in `call'
|
60
|
+
rack (1.5.5) lib/rack/content_length.rb:14:in `call'
|
61
|
+
rack (1.5.5) lib/rack/handler/webrick.rb:60:in `service'
|
62
|
+
/Users/stannajl/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
|
63
|
+
/Users/stannajl/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
|
64
|
+
/Users/stannajl/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
|
65
|
+
|
66
|
+
|
67
|
+
Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/actionpack-4.1.16/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.5ms)
|
68
|
+
Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/actionpack-4.1.16/lib/action_dispatch/middleware/templates/routes/_route.html.erb (1.0ms)
|
69
|
+
Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/actionpack-4.1.16/lib/action_dispatch/middleware/templates/routes/_route.html.erb (1.1ms)
|
70
|
+
Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/actionpack-4.1.16/lib/action_dispatch/middleware/templates/routes/_table.html.erb (8.1ms)
|
71
|
+
Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/actionpack-4.1.16/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (110.5ms)
|
72
|
+
|
73
|
+
|
74
|
+
Started GET "/" for 127.0.0.1 at 2017-06-19 11:49:49 -0400
|
75
|
+
Processing by Rails::WelcomeController#index as HTML
|
76
|
+
Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (0.1ms)
|
77
|
+
Completed 200 OK in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
|
78
|
+
|
79
|
+
|
80
|
+
Started GET "/" for 127.0.0.1 at 2017-06-19 11:50:41 -0400
|
81
|
+
Processing by Rails::WelcomeController#index as HTML
|
82
|
+
Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (1.8ms)
|
83
|
+
Completed 200 OK in 15ms (Views: 15.2ms | ActiveRecord: 0.0ms)
|
84
|
+
|
85
|
+
|
86
|
+
Started GET "/" for 127.0.0.1 at 2017-06-19 11:54:11 -0400
|
87
|
+
Processing by Rails::WelcomeController#index as HTML
|
88
|
+
Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (1.7ms)
|
89
|
+
Completed 200 OK in 15ms (Views: 15.0ms | ActiveRecord: 0.0ms)
|
90
|
+
|
91
|
+
|
92
|
+
Started GET "/" for 127.0.0.1 at 2017-06-19 12:01:58 -0400
|
93
|
+
Processing by Rails::WelcomeController#index as HTML
|
94
|
+
Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (1.7ms)
|
95
|
+
Completed 200 OK in 15ms (Views: 15.0ms | ActiveRecord: 0.0ms)
|
96
|
+
|
97
|
+
|
98
|
+
Started GET "/" for 127.0.0.1 at 2017-06-19 12:02:04 -0400
|
99
|
+
Processing by Rails::WelcomeController#index as HTML
|
100
|
+
Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (0.1ms)
|
101
|
+
Completed 200 OK in 2ms (Views: 2.4ms | ActiveRecord: 0.0ms)
|
102
|
+
|
103
|
+
|
104
|
+
Started GET "/" for 127.0.0.1 at 2017-06-19 13:08:10 -0400
|
105
|
+
Processing by Rails::WelcomeController#index as HTML
|
106
|
+
Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (2.2ms)
|
107
|
+
Completed 200 OK in 17ms (Views: 17.0ms | ActiveRecord: 0.0ms)
|
108
|
+
|
109
|
+
|
110
|
+
Started GET "/" for 127.0.0.1 at 2017-06-19 13:10:18 -0400
|
111
|
+
Processing by Rails::WelcomeController#index as HTML
|
112
|
+
Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (0.1ms)
|
113
|
+
Completed 200 OK in 2ms (Views: 2.3ms | ActiveRecord: 0.0ms)
|
114
|
+
|
115
|
+
|
116
|
+
Started GET "/" for 127.0.0.1 at 2017-06-19 13:11:29 -0400
|
117
|
+
Processing by Rails::WelcomeController#index as HTML
|
118
|
+
Rendered /Users/stannajl/.rvm/gems/ruby-2.3.1/gems/railties-4.1.16/lib/rails/templates/rails/welcome/index.html.erb (1.8ms)
|
119
|
+
Completed 200 OK in 15ms (Views: 15.0ms | ActiveRecord: 0.0ms)
|
data/test/dummy/log/test.log
CHANGED
@@ -50,3 +50,11 @@ RustyEngine::FailuresControllerTest: test_should_get_index
|
|
50
50
|
RustyEngineTest: test_truth
|
51
51
|
---------------------------
|
52
52
|
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
53
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.4ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
54
|
+
[1m[36m (1.5ms)[0m [1mCREATE TABLE "rusty_engine_profiles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "text" text, "created_at" datetime, "updated_at" datetime) [0m
|
55
|
+
[1m[35m (1.0ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
56
|
+
[1m[36m (1.2ms)[0m [1mselect sqlite_version(*)[0m
|
57
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
58
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
59
|
+
[1m[35m (0.8ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20170615202658')
|
60
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
2
|
+
|
3
|
+
# This model initially had no columns defined. If you add columns to the
|
4
|
+
# model remove the '{}' from the fixture names and add the columns immediately
|
5
|
+
# below each fixture, per the syntax in the comments below
|
6
|
+
#
|
7
|
+
one: {}
|
8
|
+
# column: value
|
9
|
+
#
|
10
|
+
two: {}
|
11
|
+
# column: value
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rusty_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- JoeStannard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -51,28 +51,36 @@ files:
|
|
51
51
|
- Rakefile
|
52
52
|
- app/assets/javascripts/rusty_engine/application.js
|
53
53
|
- app/assets/javascripts/rusty_engine/profiles.js
|
54
|
+
- app/assets/javascripts/rusty_engine/recentmessage.js
|
54
55
|
- app/assets/stylesheets/rusty_engine/application.css
|
55
56
|
- app/assets/stylesheets/rusty_engine/profiles.css
|
57
|
+
- app/assets/stylesheets/rusty_engine/recentmessage.css
|
56
58
|
- app/assets/stylesheets/scaffold.css
|
57
59
|
- app/controllers/rusty_engine/application_controller.rb
|
58
60
|
- app/controllers/rusty_engine/profiles_controller.rb
|
61
|
+
- app/controllers/rusty_engine/recentmessage_controller.rb
|
59
62
|
- app/helpers/rusty_engine/application_helper.rb
|
60
63
|
- app/helpers/rusty_engine/failures_helper.rb
|
61
64
|
- app/helpers/rusty_engine/profiles_helper.rb
|
65
|
+
- app/helpers/rusty_engine/recentmessage_helper.rb
|
62
66
|
- app/models/rusty_engine/profile.rb
|
67
|
+
- app/models/rusty_engine/recentmessages.rb
|
63
68
|
- app/views/layouts/rusty_engine/application.html.erb
|
64
69
|
- app/views/rusty_engine/profiles/_form.html.erb
|
65
70
|
- app/views/rusty_engine/profiles/edit.html.erb
|
66
71
|
- app/views/rusty_engine/profiles/index.html.erb
|
67
72
|
- app/views/rusty_engine/profiles/new.html.erb
|
68
73
|
- app/views/rusty_engine/profiles/show.html.erb
|
74
|
+
- app/views/rusty_engine/recentmessage/index.html.erb
|
69
75
|
- config/routes.rb
|
70
76
|
- db/migrate/20170615202658_create_rusty_engine_profiles.rb
|
77
|
+
- db/migrate/20170616193639_create_rusty_engine_recentmessages.rb
|
71
78
|
- lib/rusty_engine.rb
|
72
79
|
- lib/rusty_engine/engine.rb
|
73
80
|
- lib/rusty_engine/version.rb
|
74
81
|
- lib/tasks/rusty_engine_tasks.rake
|
75
82
|
- test/controllers/rusty_engine/profiles_controller_test.rb
|
83
|
+
- test/controllers/rusty_engine/recentmessage_controller_test.rb
|
76
84
|
- test/dummy/README.rdoc
|
77
85
|
- test/dummy/Rakefile
|
78
86
|
- test/dummy/app/assets/javascripts/application.js
|
@@ -112,10 +120,13 @@ files:
|
|
112
120
|
- test/dummy/public/500.html
|
113
121
|
- test/dummy/public/favicon.ico
|
114
122
|
- test/fixtures/rusty_engine/profiles.yml
|
123
|
+
- test/fixtures/rusty_engine/recentmessages.yml
|
115
124
|
- test/helpers/rusty_engine/failures_helper_test.rb
|
116
125
|
- test/helpers/rusty_engine/profiles_helper_test.rb
|
126
|
+
- test/helpers/rusty_engine/recentmessage_helper_test.rb
|
117
127
|
- test/integration/navigation_test.rb
|
118
128
|
- test/models/rusty_engine/profile_test.rb
|
129
|
+
- test/models/rusty_engine/recentmessages_test.rb
|
119
130
|
- test/rusty_engine_test.rb
|
120
131
|
- test/test_helper.rb
|
121
132
|
homepage: https://github.com/rougehero/railsEngineTest.git
|
@@ -144,6 +155,7 @@ specification_version: 4
|
|
144
155
|
summary: Testing how to implement engines
|
145
156
|
test_files:
|
146
157
|
- test/controllers/rusty_engine/profiles_controller_test.rb
|
158
|
+
- test/controllers/rusty_engine/recentmessage_controller_test.rb
|
147
159
|
- test/dummy/app/assets/javascripts/application.js
|
148
160
|
- test/dummy/app/assets/stylesheets/application.css
|
149
161
|
- test/dummy/app/controllers/application_controller.rb
|
@@ -183,9 +195,12 @@ test_files:
|
|
183
195
|
- test/dummy/Rakefile
|
184
196
|
- test/dummy/README.rdoc
|
185
197
|
- test/fixtures/rusty_engine/profiles.yml
|
198
|
+
- test/fixtures/rusty_engine/recentmessages.yml
|
186
199
|
- test/helpers/rusty_engine/failures_helper_test.rb
|
187
200
|
- test/helpers/rusty_engine/profiles_helper_test.rb
|
201
|
+
- test/helpers/rusty_engine/recentmessage_helper_test.rb
|
188
202
|
- test/integration/navigation_test.rb
|
189
203
|
- test/models/rusty_engine/profile_test.rb
|
204
|
+
- test/models/rusty_engine/recentmessages_test.rb
|
190
205
|
- test/rusty_engine_test.rb
|
191
206
|
- test/test_helper.rb
|