You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try render a collection from cursor in Ruby on Rails (it may be useful for rendering big collections).
But got an error undefined method 'size' for #<PostgreSQLCursor::Cursor:0x00007fcc4edd4dd0
Steps to reproduce:
Create user and database:
$ psql
postgres=# create user books with password 'books';
CREATE ROLE
postgres=# create database books_development owner books;
CREATE DATABASE
Create test application:
rails new books --database postgresql
cd books
Fix development block in config/database.yml file for connect to database.
Add controller and run server:
bundle add postgresql_cursor
rails g scaffold book name:string
rails db:migrate
rails s
NoMethodError in Books#index
Showing books/app/views/books/index.html.erb where line #6 raised:
undefined method `size' for #<PostgreSQLCursor::Cursor:0x00007fcc4edd4dd0 @sql="SELECT \"books\".* FROM \"books\"", ...
The text was updated successfully, but these errors were encountered:
Hello!
I try render a collection from cursor in Ruby on Rails (it may be useful for rendering big collections).
But got an error
undefined method 'size' for #<PostgreSQLCursor::Cursor:0x00007fcc4edd4dd0
Steps to reproduce:
Create user and database:
Create test application:
rails new books --database postgresql cd books
Fix development block in
config/database.yml
file for connect to database.Add controller and run server:
Testing
Open in a browser: http://localhost:3000/books
It should show book list (now empty).
Append one or several books to list.
Modify view file for use render of collection
Link http://localhost:3000/books should show book list.
Modify view
index.html.erb
for use postgresql_cursor enumAppend
.each_instance
to books collection:Refresh book list in browser. It show an error:
The text was updated successfully, but these errors were encountered: