This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FactoryGirl.define do | |
factory :user do | |
first_name "Joel" | |
last_name "Brewer" | |
email { "#{first_name}.#{last_name}@example.com".downcase } | |
password "booyabooya" | |
password_confirmation "booyabooya" | |
user_type "entrepreneur" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ConversationsController < ApplicationController | |
before_filter :authenticate_user! | |
def create | |
conversation_params | |
recipient_email = params[:conversation][:recipients] | |
recipient = User.where(email: recipient_email) | |
current_user.send_message(recipient, params[:conversation][:body], params[:conversation][:subject]).conversation | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
activerecord (4.0.0) lib/active_record/reflection.rb:391:in `primary_key' | |
activerecord (4.0.0) lib/active_record/reflection.rb:226:in `association_primary_key' | |
activerecord (4.0.0) lib/active_record/associations/belongs_to_association.rb:62:in `replace_keys' | |
activerecord (4.0.0) lib/active_record/associations/belongs_to_polymorphic_association.rb:13:in `replace_keys' | |
activerecord (4.0.0) lib/active_record/associations/belongs_to_association.rb:14:in `replace' | |
activerecord (4.0.0) lib/active_record/associations/singular_association.rb:17:in `writer' | |
activerecord (4.0.0) lib/active_record/associations/builder/association.rb:78:in `receiver=' | |
mailboxer (0.11.0) app/models/message.rb:64:in `block in build_receipt' | |
mailboxer (0.11.0) app/models/message.rb:61:in `tap' | |
mailboxer (0.11.0) app/models/message.rb:61:in `build_receipt' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%h1 New Project | |
= form_for @project do |f| | |
= render 'shared/error_messages', object: f.object | |
%div | |
= f.label :title | |
= f.text_field :title | |
%div | |
= f.label :contact_name | |
= f.text_field :contact_name | |
%div |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProjectsController < ApplicationController | |
before_filter :authenticate_user! | |
before_action :correct_user, only: :destroy | |
def create | |
@project = current_user.projects.build(project_params) | |
if @project.save | |
flash[:success] = "Project created!" | |
redirect_to profile_path | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Project < ActiveRecord::Base | |
belongs_to :user | |
validates :user_id, presence: true | |
validate :project_count_within_limit, :on => :create | |
validates :title, | |
:contact_name, | |
:email_address, | |
:phone_number, | |
:description, | |
:category, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe ProjectsController do | |
let(:user) { FactoryGirl.create(:user) } | |
describe "GET #index" do | |
context "when user is not signed in" do | |
it "redirects to sign up page" do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"utf8"=>"✓", | |
"q"=>{"category_cont"=>"asian_restaurant", "sub_category_cont"=>""}, | |
"commit"=>"search", | |
"action"=>"index", | |
"controller"=>"projects"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%nav | |
%ul | |
= render 'layouts/all_user_links' | |
- if signed_in? | |
- if current_user.investor? | |
= render 'layouts/investor_links' | |
- if current_user.entrepreneur? | |
= render 'layouts/entrepreneur_links' | |
= render 'layouts/all_signed_in_user_links' | |
- else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NameError in ProjectsController#new | |
uninitialized constant User::Project | |
Extracted source (around line #25): | |
def new | |
@project = current_user.build_project | |
@categories = ProjectCategory.all | |
end |
OlderNewer