Skip to content

Instantly share code, notes, and snippets.

class Admin::ApplicationController < ApplicationController
before_action :authorize_admin!
def index
@users = User.all
@forums = Forum.all
end
private
<div class='page-header'>
<h2>User - <%= @user.email %></h2><br>
<p>Has been a user since <%= time_ago_in_words(@user.created_at) %> ago</p>
<h4>Comments Made:</h4>
<% @comments.each do |comment| %>
<%= comment.text %>
<% end %>
<blockquote class="comment">
<%= simple_format(comment.text) %>
<footer>
<%= time_ago_in_words(comment.created_at) %> ago
by <cite><%= comment.author.email %></cite>
</footer>
</blockquote>
mfifth:~/workspace $ bundle exec rspec
.......F
Failures:
1) Users have functionality to delete their own topic's
Failure/Error: click_link "Best Chinese Food"
Capybara::ElementNotFound:
Unable to find link "Best Chinese Food"
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: 5
timeout: 5000
mfifth:~/workspace $ bundle exec rspec
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize': could not connect to server: Connection refused (PG::ConnectionBad)
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
from /usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new'
from /usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `co nect'
from /usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
from /usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
from /usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/acti
development:
adapter: postgresql
encoding: utf8
database: inventory_development
host: localhost
pool: 5
timeout: 5000
test:
adapter: postgresql
<%= simple_form_for [@user, @message] do |f| %>
<%= f.input :body %>
<%= f.input :to, as: :string %>
<%= f.input :from, as: :string %>
<%= f.button :submit, class: "new btn-primary" %>
<% end %>
class MessagesController < ApplicationController
before_action :set_user
def index
@messages = @user.messages
@message = Message.new
end
def create
@message = Message.create(message_params)
<%= simple_form_for [@user, @message] do |f| %>
<%= f.input :recipient %>
<%= f.input :body %>
<%= f.button :submit, class: "new btn-primary" %>
<% end %>