Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionView::Template::Error (undefined method `expr' for 15:Fixnum) Rails 4.2.3 #448

Closed
lustremedia opened this issue Jul 31, 2015 · 10 comments

Comments

@lustremedia
Copy link

Using Rails 4.2.3
Using will_paginate (3.0.7)

When calling:

def index
    @user = User.order("ID DESC").paginate(page: params[:page], per_page: 15)
end

I got following error ActionView::Template::Error (undefined method expr' for 15:Fixnum)` not much more in the stack trace.

The error seems to occur when the user objects are looped in the view.

<% @users.each do |user| %>
...

Works fine:

def index
  @user = User.all
end
@lustremedia lustremedia changed the title undefined method `expr' for 15:Fixnum Rails 4.2.3 ActionView::Template::Error (undefined method `expr' for 15:Fixnum) Rails 4.2.3 Jul 31, 2015
@Seralto
Copy link

Seralto commented Oct 5, 2015

I'm having this issue with Firebird database.
What DB are you using?

@lustremedia
Copy link
Author

@Seralto I am on Oracle!

@Seralto
Copy link

Seralto commented Oct 6, 2015

This is strange @lustremedia, because the gem has a conditional to Oracle in active_record.rb file:

...
oracle = self.connection.adapter_name =~ /^(oracle|oci$)/i
if oracle
  query = <<-SQL
    SELECT * FROM (
      SELECT rownum rnum, a.* FROM (#{query}) a
      WHERE rownum <= #{pager.offset + pager.per_page}
    ) WHERE rnum >= #{pager.offset}
  SQL
 ...

@lustremedia
Copy link
Author

Strange, could it be the ordering that causes the issue?

@Seralto
Copy link

Seralto commented Oct 7, 2015

I don't know, I'm having problems with Firebird and I can't find a solution...

@mateusnava
Copy link

I have the same problem :-(. @Seralto, did you fix this?

@Seralto
Copy link

Seralto commented Jan 7, 2016

Hi @mateusnava, I changed my database to PostgreSQL and it solve my problem.
But if you are using "https://github.com/rowland/activerecord-fb-adapter", try to include the git path to the adapter in your Gemfile: gem 'activerecord-fb-adapter', git: "https://github.com/rowland/activerecord-fb-adapter"

@mateusnava
Copy link

@Seralto, is not working, for this moment I make a (sux) "monkey patch".

class Fixnum
def expr
self
end
end

@Seralto
Copy link

Seralto commented Feb 29, 2016

@mateusnava, use gem 'activerecord-fb-adapter', '~> 1.0', '>= 1.0.3'.
This works for me.

@mislav
Copy link
Owner

mislav commented May 10, 2021

Closing as most likely an issue with the database adapter. This library has no invocation of expr.

@mislav mislav closed this as completed May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants