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

  • Home
  • SEARCH
  • 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 6153995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:11:12+00:00 2026-05-23T20:11:12+00:00

Been Facing this issue,I Have as my view <%= form_for(:pin, :url => {:action =>fees})

  • 0

Been Facing this issue,I Have as my view

 <%= form_for(:pin, :url => {:action =>"fees"}) do |f| %>
 <%= f.text_field :pin_no %>
 <%= f.submit "Check Pin" , :class => "new_button round" %>
 <% end %>

and in my controller i have

def fees
@title = "Pay Fees"
pin = Pin.check_pin(params[:pin][:pin_no])
if pin.nil?
  flash.now[:error] = "Pin is not Avaliable"
  render 'fees'
else
  flash.now[:success] = "Pin Avaliable"
end
end

in my model, i have a check_pin method defined thus

def check_pin(pin_to_check)  
  pin = find_by_pin_no(pin_to_check)
   if pin.nil?
     nil
   else
     pin
    end
  end

and i always have this error

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]

what am i missing here please?

  • 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-23T20:11:13+00:00Added an answer on May 23, 2026 at 8:11 pm

    You get params[:pin][:pin_no] only when you post the form so it is giving error nil.[] so add request.post? to check it only when form is post

    def fees
      @title = "Pay Fees"
      if request.post?
        pin = Pin.check_pin(params[:pin][:pin_no])
        if pin.nil?
          flash.now[:error] = "Pin is not Avaliable"
          render 'fees'
        else
          flash.now[:success] = "Pin Avaliable"
        end
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My development team of four people has been facing this issue for some time
We have been facing Out of Memory errors in our App server for sometime.
I have a public facing website that has been receiving a number of SQL
This is a problem I have been trying to track down for a couple
I am working on a Google App Engine application, and have been facing some
I have been trying to get simple YES/NO radio buttons list working but facing
I've been facing in the last days a very weird and specific issue under
Context: An ongoing problem we have been facing is unit testing our market data
Here is the problem I am facing. I have been tasked with testing the
So, I have been facing a problem with using subprocess for a python app

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.