Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Build a Simple Ruby on Rails Application Frontend Development Laying Out the Page

James Joyce
James Joyce
3,551 Points

ActiveRecord::StatementInvalid in StatusesController#index

localhost:3000 returns the getting started Ruby on Rails screen. localhost:3000/statuses returns this:

ActiveRecord::StatementInvalid in StatusesController#index

Could not find table 'statuses' Rails.root: /Users/jamesjoyce/treehouse/projects/treebook

Application Trace | Framework Trace | Full Trace app/controllers/statuses_controller.rb:5:in `index'

My code in app/controllelrs/statuses_controller.rb:

class StatusesController < ApplicationController # GET /statuses # GET /statuses.json def index @statuses = Status.all

respond_to do |format|
  format.html # index.html.erb
  format.json { render json: @statuses }
end

end

# GET /statuses/1 # GET /statuses/1.json def show @status = Status.find(params[:id])

respond_to do |format|
  format.html # show.html.erb
  format.json { render json: @status }
end

end

# GET /statuses/new # GET /statuses/new.json def new @status = Status.new

respond_to do |format|
  format.html # new.html.erb
  format.json { render json: @status }
end

end

# GET /statuses/1/edit def edit @status = Status.find(params[:id]) end

# POST /statuses # POST /statuses.json def create @status = Status.new(params[:status])

respond_to do |format|
  if @status.save
    format.html { redirect_to @status, notice: 'Status was successfully created.' }
    format.json { render json: @status, status: :created, location: @status }
  else
    format.html { render action: "new" }
    format.json { render json: @status.errors, status: :unprocessable_entity }
  end
end

end

# PUT /statuses/1 # PUT /statuses/1.json def update @status = Status.find(params[:id])

respond_to do |format|
  if @status.update_attributes(params[:status])
    format.html { redirect_to @status, notice: 'Status was successfully updated.' }
    format.json { head :no_content }
  else
    format.html { render action: "edit" }
    format.json { render json: @status.errors, status: :unprocessable_entity }
  end
end

end

# DELETE /statuses/1 # DELETE /statuses/1.json def destroy @status = Status.find(params[:id]) @status.destroy

respond_to do |format|
  format.html { redirect_to statuses_url }
  format.json { head :no_content }
end

end end

1 Answer

James Joyce
James Joyce
3,551 Points

Nevermind I think I fixed it. I changed the Gemfile.lock (line 79 in my code)

from rake (0.9.2.2) to rake (10.5.0)