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 9145277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:28:30+00:00 2026-06-17T10:28:30+00:00

I receive a noMethodError when attempting to utilize a method in my application_helper file.

  • 0

I receive a noMethodError when attempting to utilize a method in my application_helper file.

It looks like the helper method itself is fine, but the code inside the helper method is whats triggering the error. I have double checked my model and schema files to be certain that I had the attributes listed correctly. A fresh pair of eyes on this would be well received.

Here’s my code…

application_helper.rb

PS. I’m showing both sets of helper methods here because this first set (Resident Helper Methods) works fine in the views it was intended for.

    # START -- Resident Helper Methods
      def resident_full_name
        ([@resident.fname, @resident.lname] - [ '' ]).compact.join(' ')
      end

      def resident_dob
        @resident.dob
      end

      def resident_gender
        @resident.gender
      end

      def resident_doc_full_name
        ([@resident.doc_fname, @resident.doc_lname] - [ '' ]).compact.join(' ')
      end

      def resident_doc_phone1
        @resident.doc_phone1
      end

      def resident_doc_address
        @resident.doc_address
      end

      def resident_doc_city
        @resident.doc_city
      end

      def resident_doc_state
        @resident.doc_state
      end

      def resident_doc_zip
        @resident.doc_zip
      end

      def resident_guard_full_name
        @resident.guard_full_name
      end

      def resident_guard_phone
        @resident.guard_phone
      end

      def resident_desrep_full_name
        @resident.desrep_full_name
      end

      def resident_desrep_phone
        @resident.desrep_phone
      end
    # END -- Resident Helper Methods
    # START -- User Helper Methods
      def user_full_name
        ([@user.fname, @user.lname] - [ '' ]).compact.join(' ')
      end
    # END -- User Helper Methods
    # START -- User Helper Methods
  def user_full_name
    @user_full_name = ([@user.fname, @user.lname] - [ '' ]).compact.join(' ')
    return @user_full_name
  end
# END -- User Helper Methods
# START -- Admin Helper Methods
  def fac_owner_full_name
    @fac_owner_full_name = ([@admin.owner_fname, @admin.owner_lname] - [ '' ]).compact.join(' ')
    return @fac_owner_full_name
  end

  def fac_name
    @fac_name = @admin.fac_name
    return @fac_name
  end

  def fac_lic_num
    @fac_lic_num = @admin.lic_num
    return @fac_lic_num
  end

  def fac_address
    @fac_address = @admin.fac_address
    return @fac_address
  end

  def fac_state
    @fac_state = @admin.fac_state
    return @fac_state
  end

  def fac_zip
    @fac_zip = @admin.fac_zip
    return @fac_zip
  end

  def fac_email
    @fac_email = @admin.fac_email1
    return @fac_email
  end

  def fac_phone
    @fac_phone = @admin.fac_phone1
    return @fac_phone
  end
# END -- Admin Helper Methods

show.html.erb

<tr>
    <td>
        <label for="fac_name">
            <b>Name of Facility/Home</b><br/>
            logger.debug(fac_owner_full_name)

            <%= fac_owner_full_name %>
            <%#= fac_name %>
        </label>
    </td>
    <td>
        <label for="fac_lic_num">
            <b>License Number</b><br />
            <%#= fac_lic_num %>
        </label>
    </td>
    <td>
        <label for="fac_email">
            <b>Email</b><br />
            <%#= fac_email %>
        </label>
    </td>
    <td>
        <label for="fac_phone">
            <b>Phone</b><br />
            <%#= fac_phone %>
        </label>
    </td>
    <td>
        <label for="fac_address">
            <b>Facility Address</b><br />
            <address>
                <%#= fac_address %><br />
                <%#= fac_city " " %><%#= fac_state %><br />
                <%#= fac_zip %>
            </address>
        </label>
    </td>
    <td>
        <label for="fac_owner_full_name">
            <b>Licensee Name</b><br />
            <%#= fac_owner_full_name %>
        </label>
    </td>
</tr>
<tr>
    <td>
        <label for="involved_person_full_name">
            <%= @incident_accident_form.involved_person_full_name %>
        </label>
    </td>

db/schema.rb

create_table "admins", :force => true do |t|
    t.string   "owner_fname"
    t.string   "owner_lname"
    t.string   "lic_num"
    t.text     "fac_address"
    t.string   "fac_city"
    t.string   "fac_state"
    t.string   "fac_zip"
    t.string   "fac_name"
    t.string   "fac_phone1"
    t.string   "fac_phone2"
    t.string   "fac_phone3"
    t.string   "fac_phone4"
    t.string   "fac_phone5"
    t.string   "fac_phone6"
    t.string   "fac_phone7"
    t.string   "fac_phone8"
    t.string   "fac_phone9"
    t.string   "fac_phone10"
    t.string   "fac_phone11"
    t.string   "fac_phone12"
    t.string   "fac_phone13"
    t.string   "fac_phone14"
    t.string   "fac_phone15"
    t.string   "fac_phone16"
    t.string   "fac_phone17"
    t.string   "fac_phone18"
    t.string   "fac_phone19"
    t.string   "fac_phone20"
    t.string   "fac_phone21"
    t.string   "fac_phone22"
    t.string   "fac_phone23"
    t.string   "fac_phone24"
    t.string   "fac_phone25"
    t.string   "fac_phone26"
    t.string   "fac_phone27"
    t.string   "fac_phone28"
    t.string   "fac_phone29"
    t.string   "fac_phone30"
    t.string   "fac_email1"
    t.string   "fac_email2"
    t.string   "fac_email3"
    t.string   "fac_email4"
    t.string   "fac_email5"
    t.string   "fac_email6"
    t.string   "fac_email7"
    t.string   "fac_email8"
    t.string   "fac_email9"
    t.string   "fac_email10"
    t.datetime "created_at",  :null => false
    t.datetime "updated_at",  :null => false
  end

models/admin.rb

class Admin < ActiveRecord::Base
  attr_accessible :fac_address, :fac_city, :fac_name, :fac_state, :fac_zip, :lic_num,
  :owner_fname, :owner_lname, :fac_phone1, :fac_phone2, :fac_phone3, :fac_phone4, :fac_phone5,
  :fac_phone6, :fac_phone7, :fac_phone8, :fac_phone9, :fac_phone10, :fac_phone11, :fac_phone12,
  :fac_phone13, :fac_phone14, :fac_phone15, :fac_phone16, :fac_phone17, :fac_phone18,
  :fac_phone19, :fac_phone20, :fac_phone21, :fac_phone22, :fac_phone23, :fac_phone24,
  :fac_phone25, :fac_phone26, :fac_phone27, :fac_phone28, :fac_phone29, :fac_phone30,
  :fac_email1, :fac_email2, :fac_email3, :fac_email4, :fac_email5, :fac_email6, :fac_email7,
  :fac_email8, :fac_email9, :fac_email10

  # has_many :users
  # validate_on_create :user_count_within_bounds


  private

  def user_count_within_bounds
    return if users.blank?
    errors.add("") if users.length > 10
    errors.add("") if users.length > 25
  end
end

UPDATED 01-17-13 11:30PM EST output from server

Started GET "/residents/1/incident_accident_forms/11" for 127.0.0.1 at 2013-01-17 23:23:57 -0500
Processing by IncidentAccidentFormsController#show as HTML
  Parameters: {"resident_id"=>"1", "id"=>"11"}
  Resident Load (1.0ms)  SELECT "residents".* FROM "residents" WHERE "residents"."id" = $1 LIMIT 1  [["id", "1"]]
  IncidentAccidentForm Load (1.3ms)  SELECT "incident_accident_forms".* FROM "incident_accident_forms" WHERE "incident_accident_forms"."resident_id" = 1 AND "incident_accident_forms"."id" = $1 LIMIT 1  [["id", "11"]]
  Rendered incident_accident_forms/show.html.erb within layouts/application (6.3ms)
Completed 500 Internal Server Error in 14ms

ActionView::Template::Error (undefined method `owner_fname' for nil:NilClass):
    12:                             <b>Name of Facility/Home</b><br/>
    13:                             logger.debug(fac_owner_full_name)
    14: 
    15:                             <%= fac_owner_full_name %>
    16:                             <%= fac_name %>
    17:                         </label>
    18:                     </td>
  app/helpers/application_helper.rb:74:in `fac_owner_full_name'
  app/views/incident_accident_forms/show.html.erb:15:in `_app_views_incident_accident_forms_show_html_erb__403107391156795487_2183850600'


  Rendered /Users/beracus/.rvm/gems/ruby-1.9.3-p362/gems/actionpack-3.2.9/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.5ms)
  Rendered /Users/beracus/.rvm/gems/ruby-1.9.3-p362/gems/actionpack-3.2.9/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.0ms)
  Rendered /Users/beracus/.rvm/gems/ruby-1.9.3-p362/gems/actionpack-3.2.9/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (9.4ms)

UPDATED incident_accident_forms_controller.rb

class IncidentAccidentFormsController < ApplicationController
  before_filter :get_resident
  before_filter :get_admin

  def index
    @incident_accident_forms = @resident.incident_accident_forms
  end

  def new
    @incident_accident_form = @resident.incident_accident_forms.build
  end

  def create
    @incident_accident_form = @resident.incident_accident_forms.build(params[:incident_accident_form])
    if @incident_accident_form.save
      redirect_to [@admin, @resident, @incident_accident_form] #, flash[:success] = "Form was created!"
    else
      render 'new', flash[:error] = "There was a problem with the form"
    end
  end

  def show
    @incident_accident_form = @resident.incident_accident_forms.find(params[:id])
  end

  def update
    @incident_accident_form = @resident.incident_accident_forms.find(params[:id])
    if @incident_accident_form.update_attributes(params[:incident_accident_form])
      flash[:success] = "Form updated!"
      redirect_to controller: 'residents', action: 'show', id: params[:id]
    else
      render 'edit', flash[:error] = "Unable to update form"
    end
  end

  def edit
    @incident_accident_form = @resident.incident_accident_forms.find(params[:id])
  end

  def destroy
    @incident_accident_form = @resident.incident_accident_forms.find(params[:id])
    @incident_accident_form.destroy
    flash[:notice] = "You sure?"
    redirect_to resident_incident_accident_forms_path
  end

  private
  # get_resident converts the resident_id given by the routing
  # into an @resident object, for use in this controller & coresponding views
  def get_resident
    @resident = Resident.find(params[:resident_id])
  end

  def get_admin
    @admin = Admin.find(params[:admin_id])
  end
end
  • 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-06-17T10:28:31+00:00Added an answer on June 17, 2026 at 10:28 am

    This error is essentially saying @admin is nil since you are trying to call the owner_fname method on @admin in fac_owner_full_name. I’d double check you are actually setting that variable in your controller.

    This seems to be confirmed, as your IncidentAccidentFormsController#show action isn’t making any SQL calls to your admins table.

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

Sidebar

Related Questions

I receive a date in the format below from a json file. Im not
I receive a dictionary as input, and would like to to return a dictionary
I receive Date and time from CSV file The received Date format is YYYYMMDD
I receive message from the server and it looks as this: <?xml version=1.0 encoding=UTF-8?>
I receive numeric variables in my queryString. I'm doing validation with the following code:
I would like to be able to identify what the name of the method
i've been following the code examples in the pickaxe book but have been recently
I receive a daily XML file which I use to update a database with
I receive back a good oauth_verifier value from the server, but it is not
I receive an SqlException when running the following code. Procedure or function 'usp_Search' expects

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.