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

Ruby On Rails Help

I am using the Cloud9 IDE I am not using local host. I have gotten Devise installed but when I click the sign up I get this error.

http://gyazo.com/689772b9eee4a0b94faf29fe34585187

This is the tutorial I am watching. https://teamtreehouse.com/library/build-a-simple-ruby-on-rails-application/creating-an-authentication-system/generating-the-user-model

This is the IDE I am using online. https://c9.io/

2 Answers

Hi Domnick,

Probably mistyping on controller, can you paste codes here from your config/routes.rb and StatusedController.rb files? I will try to see what went wrong.

For the Routes.RB

Rails.application.routes.draw do
  devise_for :users
  resources :statuses
  root to: 'statused#index'

# The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes".

# You can have the root of your site routed with "root" # root 'welcome#index'

# Example of regular route: # get 'products/:id' => 'catalog#view'

# Example of named route that can be invoked with purchase_url(id: product.id) # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase

# Example resource route (maps HTTP verbs to controller actions automatically): # resources :products

# Example resource route with options: # resources :products do # member do # get 'short' # post 'toggle' # end # # collection do # get 'sold' # end # end

# Example resource route with sub-resources: # resources :products do # resources :comments, :sales # resource :seller # end

# Example resource route with more complex sub-resources: # resources :products do # resources :comments # resources :sales do # get 'recent', on: :collection # end # end

# Example resource route with concerns: # concern :toggleable do # post 'toggle' # end # resources :posts, concerns: :toggleable # resources :photos, concerns: :toggleable

# Example resource route within a namespace: # namespace :admin do # # Directs /admin/products/* to Admin::ProductsController # # (app/controllers/admin/products_controller.rb) # resources :products # end end

For StatusController.RB

class StatusesController < ApplicationController
  before_action :set_status, only: [:show, :edit, :update, :destroy]

# GET /statuses # GET /statuses.json def index @statuses = Status.all end

# GET /statuses/1 # GET /statuses/1.json def show end

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

# GET /statuses/1/edit def edit end

# POST /statuses # POST /statuses.json def create @status = Status.new(status_params)

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

end

# PATCH/PUT /statuses/1 # PATCH/PUT /statuses/1.json def update respond_to do |format| if @status.update(status_params) format.html { redirect_to @status, notice: 'Status was successfully updated.' } format.json { render :show, status: :ok, location: @status } else format.html { render :edit } format.json { render json: @status.errors, status: :unprocessable_entity } end end end

# DELETE /statuses/1 # DELETE /statuses/1.json def destroy @status.destroy respond_to do |format| format.html { redirect_to statuses_url, notice: 'Status was successfully destroyed.' } format.json { head :no_content } end end

private # Use callbacks to share common setup or constraints between actions. def set_status @status = Status.find(params[:id]) end

# Never trust parameters from the scary internet, only allow the white list through.
def status_params
  params.require(:status).permit(:name, :content)
end

end

This is an IDE and does not rely on Local Host which is what the instructors tell you to put. I would like to know what I would replace with that.

Wow, that's pretty long. I only asked two files. :)

Basically I see there are some errors like different names - statuses vs statused? You need to be careful what you are typing in spelling.

Examples:

  resources :statuses
  root to: 'statused#index'

It should be called statuses#index, not status*ed* why?

class StatusesController < ApplicationController

Rails is expecting to find the file name to match with StatuseController, so I see your file name is StatusController.RB, correct? Then your screenshot it says StatusedController? At least try to rename it.

After you installed Devise, just make sure you find devise_for :users that is not overshadowed by resources :users, then that's good below.

Rails.application.routes.draw do
  devise_for :users

I think, you will be better understanding more controllers and models system, use this best resources - Michael Hartl's Ruby on Rails Tutorials than here. :blush:

THANKS SO MUCH! It was just that typo I made with the statused. Thanks so much man I was stuck on this for about 3 hours! By the way that was only two files.

Yah, that's awesome feeling. :sweat_smile: ....I know it must be frustrating over some minor issues, I have been there before.

If you are satisfy with the solutions, that would be greatly appreciate to mark 'best answer' to let other users know that might have similar problems near future.

Happy Coding!