From 67d95e5b92e3d19765c7ccaf5460737ffe2173f4 Mon Sep 17 00:00:00 2001 From: nfoy Date: Thu, 24 Apr 2014 19:07:40 -0400 Subject: run ./generate.sh --- app/controllers/pms_controller.rb | 2 +- app/models/pm.rb | 1 + app/views/pms/_form.html.erb | 8 ++++++++ app/views/pms/index.html.erb | 4 ++++ app/views/pms/index.json.jbuilder | 2 +- app/views/pms/show.html.erb | 10 ++++++++++ app/views/pms/show.json.jbuilder | 2 +- 7 files changed, 26 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/controllers/pms_controller.rb b/app/controllers/pms_controller.rb index b62a6ef..11f51c8 100644 --- a/app/controllers/pms_controller.rb +++ b/app/controllers/pms_controller.rb @@ -69,6 +69,6 @@ class PmsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def pm_params - params.require(:pm).permit(:author_id, :recipient_id, :message) + params.require(:pm).permit(:author_id, :recipient_id, :message, :subject, :conversation_id) end end diff --git a/app/models/pm.rb b/app/models/pm.rb index 9fce2b3..0e60f3e 100644 --- a/app/models/pm.rb +++ b/app/models/pm.rb @@ -1,4 +1,5 @@ class Pm < ActiveRecord::Base belongs_to :author belongs_to :recipient + belongs_to :conversation end diff --git a/app/views/pms/_form.html.erb b/app/views/pms/_form.html.erb index 480e308..80781a5 100644 --- a/app/views/pms/_form.html.erb +++ b/app/views/pms/_form.html.erb @@ -23,6 +23,14 @@ <%= f.label :message %>
<%= f.text_area :message %> +
+ <%= f.label :subject %>
+ <%= f.text_area :subject %> +
+
+ <%= f.label :conversation_id %>
+ <%= f.text_field :conversation_id %> +
<%= f.submit %>
diff --git a/app/views/pms/index.html.erb b/app/views/pms/index.html.erb index cb7fe4b..b5169f5 100644 --- a/app/views/pms/index.html.erb +++ b/app/views/pms/index.html.erb @@ -6,6 +6,8 @@ Author Recipient Message + Subject + Conversation @@ -18,6 +20,8 @@ <%= pm.author %> <%= pm.recipient %> <%= pm.message %> + <%= pm.subject %> + <%= pm.conversation %> <%= link_to 'Show', pm %> <%= link_to 'Edit', edit_pm_path(pm) %> <%= link_to 'Destroy', pm, method: :delete, data: { confirm: 'Are you sure?' } %> diff --git a/app/views/pms/index.json.jbuilder b/app/views/pms/index.json.jbuilder index fcfca84..3dc1abb 100644 --- a/app/views/pms/index.json.jbuilder +++ b/app/views/pms/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@pms) do |pm| - json.extract! pm, :id, :author_id, :recipient_id, :message + json.extract! pm, :id, :author_id, :recipient_id, :message, :subject, :conversation_id json.url pm_url(pm, format: :json) end diff --git a/app/views/pms/show.html.erb b/app/views/pms/show.html.erb index 5ee483f..2f3b944 100644 --- a/app/views/pms/show.html.erb +++ b/app/views/pms/show.html.erb @@ -15,5 +15,15 @@ <%= @pm.message %>

+

+ Subject: + <%= @pm.subject %> +

+ +

+ Conversation: + <%= @pm.conversation %> +

+ <%= link_to 'Edit', edit_pm_path(@pm) %> | <%= link_to 'Back', pms_path %> diff --git a/app/views/pms/show.json.jbuilder b/app/views/pms/show.json.jbuilder index 94252e9..4e69026 100644 --- a/app/views/pms/show.json.jbuilder +++ b/app/views/pms/show.json.jbuilder @@ -1 +1 @@ -json.extract! @pm, :id, :author_id, :recipient_id, :message, :created_at, :updated_at +json.extract! @pm, :id, :author_id, :recipient_id, :message, :subject, :conversation_id, :created_at, :updated_at -- cgit v1.2.3-54-g00ecf