Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7508291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:39:17+00:00 2026-05-29T22:39:17+00:00

I’m new to rails and setting up the ticketee project based on Rails in

  • 0

I’m new to rails and setting up the ticketee project based on Rails in Action 3, I’m attempting to deviate slightly and setup haml with views/projects/show.html.haml

I do have the Gemfile configured and haml installed and I tested a basic haml page and it does work.

Here is my problem, when migrating the show.html.erb to haml I am getting an error I can’t resolve.

show.html.erb:

<h1><%= @project.name %></h1>

This displays fine if I go to http://localhost:3000/projects/1 it displays the project name with id 1.

show.html.haml:

%h2= @project.name

After I replace show.html.erb with the haml and I go to the above url I get:

NoMethodError in Projects#show

Showing /ticketee/app/views/projects/show.html.haml
where line #1 raised:

undefined method `name' for nil:NilClass Extracted source (around line
#1):

1: %h2= @project.name Rails.root:
/ticketee

Application Trace | Framework Trace | Full Trace
app/views/projects/show.html.haml:1:in
`_app_views_projects_show_html_haml___2329513113615295829_70311891362660'

The schema.rb definitely has the name field:

ActiveRecord::Schema.define(:version => 20120212051007) do

    create_table "projects", :force => true do |t|
        t.string   "name"
        t.datetime "created_at", :null => false
        t.datetime "updated_at", :null => false
    end

end

And my controller:

class ProjectsController < ApplicationController
    def index

    end

    def new
        @project = Project.new
    end

    def create
        @project = Project.new(params[:project])
        @project.save
        #flash[:notice] = "Project has been created."
        redirect_to @project, :notice => "Project has been created."
    end

end

I assume this is just some oversight on my part as this is a very basic usage of haml.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:39:18+00:00Added an answer on May 29, 2026 at 10:39 pm

    It seems that you don’t have a show method inside of your Project controller. Since projects/1 means that it is a particular record, the show page would be called. When /projects is called, the index method would get called.

    A possible show method could be:

      def show
        @project = Project.find(params[:id])
      end
    

    In this method, an instance variable is assigned to @project with the ID which is in the URL. This could be the answer to your problem!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.