undefined method `page' for # Kaminari::PaginatableArray - ruby-on-rails-3

I have been using Kaminari since a while. I use to paginate generic arrays using the following line.
Kaminari.paginate_array([1,2,3]).page(1).per(1)
That use to work before but I noticed that since yesterday this show the error
undefined method `page' for #<Kaminari::PaginatableArray:0x007f8e5d10fde0>
However calling page on ActiveRecord relation is working fine. something like this is working
User.page(1).per(1)
My Gem file
source 'https://rubygems.org'
ruby '1.9.3'
gem 'rails', '3.2.8'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'pg'
# Ok lets try out the heroku business
gem 'heroku'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-fileupload-rails'
gem 'jquery-rails'
gem 'jquery-ui-rails'
# Twitter Boostrap and Upgrade dependencies
gem 'therubyracer'
gem 'less-rails'
gem 'twitter-bootstrap-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
gem 'unicorn'
# Deploy with Capistrano
gem 'capistrano'
gem 'cap_bootstrap', github: 'benrs44/cap_bootstrap'
gem 'awesome_print'
group :test, :development do
gem 'rspec-rails', '>= 2.0.1'
gem "capybara-webkit"
gem 'capybara'
gem 'launchy'
gem 'selenium-webdriver'
gem 'shoulda-matchers'
gem 'ci_reporter'
gem "factory_girl_rails", "~> 4.0"
# DRb server RSpec
gem "spork-rails"
# To use debugger
gem 'debugger'
end
group :test do
gem "guard-rspec"
gem 'rb-fsevent', '~> 0.9.1'
gem 'database_cleaner'
gem 'fuubar'
end
#Image Uploader
gem 'carrierwave'
#Image Processor
gem "rmagick"
#Video Processor
gem 'video_info'
gem 'hpricot'
#Authenitcation
gem 'omniauth-facebook', '1.4.0'
#Messaging
gem 'mailboxer', github: 'rralston/mailboxer'
gem 'haml-rails'
gem 'simple_form'
#Gelocation
gem 'geocoder'
#Search
gem 'ransack'
# For easily making nouns possessive
gem 'possessive'
#Pagination
gem "kaminari"
gem 'will_paginate', '~> 3.0'
#Web App Monitoring
gem 'newrelic_rpm'
#FB Style Newsfeeds
gem 'public_activity'
# Heroku CDN Link to AWS
gem "asset_sync"
# Carrier Wave link to AWS S#
gem 'fog', '~> 1.12.1'
gem 'cancan'
# client side validtions
gem 'client_side_validations'
# tagging
gem 'acts-as-taggable-on'
# remote file uploads
gem "remotipart", "~> 1.2.1"
# social sharing
gem 'social-share-button'
gem 'devise', "~> 2.2.3"
gem 'omniauth'
gem 'devise-async'
running bundle show bundle show kaminari gives /Users/***/.rvm/gems/ruby-1.9.3-p448/gems/kaminari-0.14.1

Turned out to be that my colleague has added a configuration file for Kaminari and changed this page function with this line.
config.page_method_name = :kaminari_page
So instead of using Kaminari.paginate_array([1,2,3]).page(1).per(1) I should now use
Kaminari.paginate_array([1,2,3]).kaminari_page(1).per(1)

Related

issue with mercury rails gem

I was working on a blog app so I want to implemant mercury-rails gem into it, i tried and i got it the tool bar but i was unable to edit any content from my show page
even after everything i am using with the foundation front end framework
<p><span id="page_content class="mercury-region" data-type="editable">
<%=raw #article.content %></span></p>
<h5><span data-type="editable"><%= #article.title %></span></h5>
this is my gem file
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'zurb-foundation'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
gem 'simple_form'
gem 'friendly_id'
gem 'devise'
gem "rmagick"
gem "carrierwave"
gem "mercury-rails"
By the looks of things you've followed the old railscast. The mercury-rails projects updates quite frequently.
The problem lies in your attributes on the span tag. You can safely remove the class="mercury-region"
You will also need to change data-type="editable" to data-mercury="full".
See the different edit types (defined in the data-mercury attribute) on the github page: https://github.com/jejacks0n/mercury#region-types
I hope that helps!

Could not update rails

When I do bundle update rails, I get this error:
Bundler could not find compatible versions for gem "activesupport":
In Gemfile:
rails (= 3.2.11) x86-mingw32 depends on
activesupport (= 3.2.11) x86-mingw32
activesupport (3.1.0)
here is my gemFile, any help is apprecaited :)
source 'http://rubygems.org'
gem 'rails' , '3.2.11'
gem "heroku"
gem 'thin'
gem 'devise'#, '1.5.2'
gem 'will_paginate', '~> 3.0.2'
#gem 'nested_form', :git => 'git://github.com/fxposter/nested_form.git'
gem "simple_form"
gem "cancan"
gem 'kaminari'
gem 'foreigner'
gem "cocoon"
gem 'client_side_validations'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
gem "jquery-rails"
gem "validate_url", "~> 0.2.0"
gem 'pg', :group => [:production]
gem 'haml'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
group :test, :development do
gem 'sqlite3'
gem 'turn', :require => false
gem "rspec-rails", "2.7"
#gem "rspec"
gem "spork", "> 0.9.0.rc"
gem 'guard-spork'
#gem "webrat", "~> 0.7.3"
gem 'rb-fsevent' # Not mandatory for guard to work, which is why it's not a dependency, but it is an optimization
#gem "guard-spork"
#gem 'minitest'
gem "factory_girl_rails", "~> 1.2"
#gem "webrat-rspec-rails"
gem "mocha"
gem 'capybara' #, :git => 'git://github.com/jnicklas/capybara.git'
gem 'database_cleaner'
gem 'launchy'
gem "capybara-webkit"
#gem 'rspec-multi-mock', :git => 'git://github.com/endeepak/rspec-multi-mock.git'
end
group :test do
#gem 'ruby-debug19', :require => 'ruby-debug'
end
gem 'execjs'
gem 'therubyracer'
First of all you have to delete Gemfile.lock
then update Gemfile to include rails 3.2.11
go to project directory
run bundle install
This may solve your problem

Unable to run growl notifications and gem growl_notify throws errors

I am unable to get growl notifications when i run $guard
Do i need any particular version for growl_notify?
Growl version = 1.2
Here is my gem file.
gem 'rails', '3.1.3'
gem 'sqlite3'
group :development, :test do
gem 'rspec-rails'
gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git'
gem 'launchy'
gem 'database_cleaner'
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
gem 'guard-rspec'
gem 'guard-livereload'
end
gem 'growl'
group :test do
gem 'guard-spork'
end
Error message when i install/ pub growl_notify in gemfile
JP:guard2 jayparteek$ guard
/Users/jayparteek/.rvm/gems/ruby-1.9.2-head#guard2/gems/rb-appscript-0.6.1/lib/appscript.rb:542:in `_send_command': CommandError (Appscript::CommandError)
OSERROR: -10000
MESSAGE: Apple event handler failed.
COMMAND: app("/Library/PreferencePanes/Growl.prefPane/Contents/Resources/GrowlHelperApp.app").register({:all_notifications=>["success", "pending", "failed", "notify"], :as_application=>"Guard", :default_notifications=>"notify"})
from /Users/jayparteek/.rvm/gems/ruby-1.9.2-head#guard2/gems/rb-appscript-0.6.1/lib/appscript.rb:642:in `method_missing'
Make sure you are running Growl 1.3.xx
In your Gemfile remove gem 'growl' and in your :test group add gem 'ruby_gntp' then run
$ gem uninstall growl_notify
$ bundle install
Should use following gemfile, with rails 3.1.3 & Growl ver 1.3.1
gem 'rails', '3.1.3'
gem 'sqlite3'
group :development, :test do
gem 'rspec-rails'
gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git'
gem 'launchy'
gem 'database_cleaner'
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
gem 'guard-rspec'
# gem 'guard-livereload'
end
group :test do
gem 'guard-spork'
gem 'ruby_gntp'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.1.5'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

test-unit gem displays test stat for every rake run

I using test-unit gem with a Rails 3.1 project, and I have a small issue. If I start rake tasks, I always see a test result, with zeros.
My Gemfile is:
source :rubygems
gem 'rails', '3.1.2'
gem 'sqlite3'
gem 'json_pure'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
# gem 'sass-rails', '~> 3.1.5.rc.2'
# gem 'coffee-rails', '~> 3.1.1'
gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# Rails i18n
gem 'rails-i18n', :git => 'git://github.com/hron84/rails-i18n.git'
# Paginator
gem 'will_paginate'
# To use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the web server
gem 'thin'
# Deploy with Capistrano
gem 'capistrano'
# To use debugger
# gem 'ruby-debug'
group :development do
gem 'rails3-generators'
gem 'nifty-generators'
end
group :test do
gem 'rspec'
gem 'rspec-rails'
gem 'ci_reporter'
gem 'factory_girl'
unless defined? Rubinius
gem 'rcov'
gem 'rcov_rails'
gem 'test-unit'
end
gem 'ruby-prof'
gem 'faker'
end
# Application-related stuffs
gem 'authlogic'
# Slug helper
gem 'slug'
# vim: ft=Gemfile
Is there a way to avoid it? What I do wrong?
Check your RAILS_ENV. Make sure it's set to "development", not "test". If that's not the culprit, try removing gems (particularly test/spec-related ones) one by one until the problem goes away. Then you'll know which gem is giving you the problem.

Could not find generator refinerycms

I am trying to integrate refinerycms into an existing application. Here is my gemfile
source 'http://rubygems.org'
gem 'rails', '~> 3.1.0.rc8'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'mysql2'
gem "arel"
gem 'pdfkit'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', "~> 3.1.0.rc"
gem 'coffee-rails', "~> 3.1.0.rc"
gem 'uglifier'
end
gem 'jquery-rails'
gem 'aws-s3', :require => 'aws/s3'
gem 'stomp'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
group :test do
# Pretty printed test output
gem 'turn', :require => false
gem 'cucumber-rails'
gem 'database_cleaner'
gem 'factory_girl'
end
gem 'refinerycms', :git => 'git://github.com/resolve/refinerycms.git'
gem 'refinerycms-generators', :git => 'git://github.com/resolve/refinerycms-generators.git'
gem 'seo_meta', :git => 'git://github.com/parndt/seo_meta.git'
# gem 'refinerycms-i18n', '~> 2.0.0', :git => 'git://github.com/resolve/refinerycms-i18n.git'
gem 'devise', '~>1.4.0'
I am following this tutorial: http://refinerycms.com/guides/attaching-refinery-cms-to-an-existing-rails-application
When I get to the rails generate refinerycms part, I receive the following error: Could not find generator refinerycms.
Any ideas on why this is happening?
Env:
rvm 1.6.30
ruby 1.9.2p180
Rails 3.1.0.rc8
The answer is to run the following command:
rails g refinery:cms