Questions tagged [nomethoderror]

A Ruby exception that is raised when a method is called on an object which doesn't respond to that method.

A NoMethodError exception is raised in Ruby when a method is called on an object that doesn't respond to that method and that doesn't have a method_missing hook to respond to it.

529 questions
-1
votes
1 answer

ruby blackjack game NoMethodError

Here is the class definition that is generating the error: class Hand attr_accessor :hand_cards, :hand_value def intitialize @hand_cards = [] @hand_value = 0 end def to_s "The hand is #{hand_cards} and has a value of…
-1
votes
2 answers

Rails: NoMethodError(s). Can't access pages

I keep getting a NoMethodError regardless of where I try and go. Going to http://localhost:3000/ gives me an undefined method new_movie_rentals_path' error. And going somewhere such as http://localhost:3000/movies/5/rentals/new (and there should be…
-1
votes
2 answers

undefined method `save' for 1:Fixnum

I made some variables that is related to models and I want to save the new variable relating to the control structure, but I can't. It said "NoMethodError - undefined method `save' for 1:Fixnum:". What I want to make is that the function if This…
-1
votes
1 answer

NoMethodError undefined method `followers_count' in users/show

I went through Treehouses tutorial on how to set up user friendships on adding and deleting friends. However, now I would like to show how many people that user is following and how many people are following that user. Michael Hartl's RoR tutorial…
Annette
  • 207
  • 1
  • 3
  • 13
-1
votes
2 answers

.joins method returning incorrect id's

UPDATE I have a simple rails app with a home page displaying the highest rated albums, using this code in my controller (used code from this solution: How to display highest rated albums through a has_many reviews relationship): def home …
-1
votes
2 answers

`add_frozen_gem_path': undefined method `source_index' for Gem:Module (NoMethodError) i am getting this error when i try running my server

from /home/rakesh/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.5/lib/initializer.rb:298:in `add_gem_load_paths' from /home/rakesh/.rvm/gems/ruby-1.8.7-p374/gems/rails-2.3.5/lib/initializer.rb:132:in `process' from…
Rakesh Mahesh
  • 13
  • 1
  • 5
-1
votes
2 answers

Rails: undefined method `capitalize' for nil:NilClass

I'm having a store controller like this : class StoreController < ApplicationController helper_method :product_type def store cat=params[:cat] subcat=params[:subcat] if cat.empty? …
mrudult
  • 2,243
  • 3
  • 28
  • 53
-1
votes
2 answers

Uncaught TypeError: Object # has no method 'fancybox' in Wordpress site
I have the error Uncaught TypeError: Object # has no method 'fancybox' in my JS console on this website http://www.e-fashion-awards.com/ As you can see, I include jquery.fancybox.js after jquery.min.js and I include jquery only once (saw in other…
cocoggu
  • 391
  • 5
  • 18
-1
votes
1 answer

NoMethodError: undefined method 'hit' for

I'm trying to make a Blackjack simulation, below is the code... one_suit = [2,3,4,5,6,7,8,9,10,10,10,10,11]; #the value of the cards for blackjack full_deck = one_suit*4; #clubs, diamonds, hearts and spades $deck = full_deck; #start off the game…
Spike Fitsch
  • 687
  • 1
  • 6
  • 12
-2
votes
1 answer

undefined method '+@' - Ruby Error

I have been trying to write a while loop in Ruby similar to the following: number = 3 string = "lalaLand" def main(number, string) n = 1 while n <= number do print string + 'something else' + n.to_s n = n + 1 …
mhz
  • 969
  • 2
  • 7
  • 27
-2
votes
1 answer

Ruby NoMethodError - Undefined method

The following is my code. I tried to only include the code where I think the problem may be. Class Ship contains getStatus: class Ship def initialize(name, size, status, shipNumber, firedUpon) @name = name @size = size @status =…
Carl
  • 43
  • 1
  • 1
  • 4
-2
votes
1 answer

NoMethodError in Ruby on Rails using haml

This is the error msg ive been getting http://i.stack.imgur.com/rcCnI.png The pins_controller.rb section of code is: class PinsController < ApplicationController before_action :find_pin, only: [:show, :edit, :update, :destroy] def index end def…
-2
votes
2 answers

Ruby on rails: undefined method `[]' for nil:NilClass?

when i try to create it says undefined method. def create @stock = Stock.find(params[:stock_availabilities][:stock_id]) @stock_availability = StockAvailability.new(stock_availabilities_params) respond_to do |format| if…
-2
votes
1 answer

NoMethodError in Posts#show---Undefined method 'title'(Blog Tutorial)

getting the undefined method 'title' error in my show view. This has been posted and resolved several in other posts but for seemingly other problems than mine. I have also double checked that I can read from the database through the rails console…
billybeb
  • 13
  • 4
-2
votes
2 answers

`': undefined method `“raf_ebooks' for main:Object (NoMethodError) -

When trying to run my twitter_ebooks bot using ruby run.rb I get this error: Faraday::Builder is now Faraday::RackBuilder. /Users/Rafi/Desktop/my_ebooks/bots.rb:14:in `': undefined method `“raf_ebooks' for main:Object…
Alakazam
  • 3
  • 2
1 2 3
35
36