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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:11:40+00:00 2026-05-26T00:11:40+00:00

I don’t see where this code is creating this NoMethodFound error, and would really

  • 0

I don’t see where this code is creating this NoMethodFound error, and would really like any helpful suggestions.

Here’s the error message:

NoMethodError in UploadsController#create

The relevant parts of my model looks like this:

  named_scope :by_name, lambda { |marker_name| 
    {:conditions => ["marker_name = ?", marker_name]}}

  def self.parse_file(file)
    FasterCSV.foreach(file.path,:headers=>"first_row", :col_sep=>"\t") do |row|

    if $header_row == 1
       $markers = {}         # define global hash for marker id lookup
        $markers_arry = []    # define global array for marker names
        get_markers(row)
        $header_row = 0
        # done with header row; loop back to beginning for first row of actual data
        next
      end
...
 def self.get_markers(row)
    offset = 8    # this was determine by trial-&-error
    i = 0
    for col in row
      i += 1
      if i < offset
        next
      end      
      this_marker = Marker.by_name(row[col])
      $markers[row[col]] = this_marker.id   # associate the marker_name with its id
      $markers_arry[col] = row[col]
    end
  end

The trace looks like:

> undefined method `by_name' for
> #<Class:0xb6726e40>
> vendor/rails/activerecord/lib/active_record/base.rb:1667:in
> `method_missing'
> app/models/upload.rb:99:in
> `get_markers'
> /usr/lib/ruby/gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:362:in
> `each'
> /usr/lib/ruby/gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:362:in
> `each' app/models/upload.rb:91:in
> `get_markers'
> app/models/upload.rb:37:in
> `parse_file'
> /usr/lib/ruby/gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:1545:in
> `each'
> /usr/lib/ruby/gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:1048:in
> `foreach'
> /usr/lib/ruby/gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:1222:in
> `open'
> /usr/lib/ruby/gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:1047:in
> `foreach' app/models/upload.rb:25:in
> `parse_file'
> app/controllers/uploads_controller.rb:55:in
> `create'
> vendor/rails/actionpack/lib/action_controller/base.rb:1162:in
> `send'
  • 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-26T00:11:41+00:00Added an answer on May 26, 2026 at 12:11 am

    Have you tried doing just “by_name” instead of “Marker.by_name” ?

    Also, Rails dynamically generates many similar methods. For instance,

    Marker.find_by_name("your_name_here")
    

    … Which ought to work regardless.

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

Sidebar

Related Questions

Don't let below code scare you away . The question is really simple, only
Don't ask why, but is there any way to suppress a failed linking error?
I don't understand why this code doesn't work: function Messages(type,text) { console.log(In function Message);
Don't know what to do with this error. How to add data in SQL
I don't get a error message when I compile the code but I cant
I don't know if this has been asked before, but what i'd like to
Don't think there's much to say, here's my code for (int i = 0;
Don't know why this conversion fails. SELECT CAST('32.999' AS INT) throws the error saying
Don't need to do this right now but thinking about the future... What would
Don't be scared of the extensive code. The problem is general. I just provided

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.