rails ajax_pagination couldn't find file 'history' - ruby-on-rails

I have installed ajax_pagination gem from https://github.com/ronalchn/ajax_pagination
When I restart my server i get this message
couldn't find file 'history'
(in
/Users/user/.rvm/gems/ruby-1.9.3-p362/gems/ajax_pagination-0.6.3/lib/assets/javascripts/ajax_pagination.js.erb:3)
and inserted calls in assets manifests, rails version is 3.2.8
I had tried installing a history gem ( https://github.com/philostler/historyjs-rails ) or adding history.js to assets but nothing helps
Thanks for any help!

I had the same issue, all you need to do is:
Add gem 'jquery-historyjs' to your Gemfile,
Run bundle install
Then rails generate historyjs:install

This appears to be a bug in the jquery-historyjs gem, which ajax_pagination depends on. You may want to report an issue on their github repo.
As a work-around, you could create a blank history.js file in app/assets/javascripts and try bringing in historyjs-rails.

Related

Deleted gem 'webpack' but keeps giving error on Heroku

I have installed gem 'webpacker' and then, commited to the server. However, when I deleted the gem, the new setting haven't been updated on Heroku.
When I run the app:
/app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/railtie/configuration.rb:95:in method_missing': undefined methodwebpacker' for # (NoMethodError)
Someone knows how to re-do gem process in the server? Thank you!
More than likely you still have some config items leftover. Search your application for webpack and webpacker. You may find a webpack folder in your config, at least.
https://github.com/rails/webpacker
I would recommend going through the setup again, to make sure you removed everything.
From the error it seems that your Gemfile.lock is not being updated.
First delete the Gemfile.lock on local system
Then remove the gem from Gemfile on local system.
Then bundle on local system with the gem in Gemfile removed.
Commit and Push to Heroku.
Hope it helps!!

Ran a bundle install, bootstrap updated, now I'm getting routing errors

I was just fiddling around with some things and happened to run bundle install on my ruby on rails app. I noticed that bootstrap updated from 3.1.1 to 3.2.0 and now when I go to generate certain views, I get this error:
ActionController::RoutingError (No route matches [GET] "/fonts/bootstrap/glyphicons-halflings-regular.ttf"):
Didn't happen until this gem update. Any suggestions? I've tried explicitly using 3.1.1 in the Gemfile and running bundle again, but this doesn't help. It looks just like a simple routing issue, but idk why this would have only changed during the gem update.
My problem was with the order I was importing bootstrap in my application.css.scss file. Make sure the order goes:
#import "bootstrap-sprockets";
#import "bootstrap";
For anyone who else can't get an answer on this, I manually changed this file:
/home//.rvm/gems/ruby-2.1.1/gems/bootstrap-sass-3.2.0.2/assets/stylesheets/bootstrap/_glyphicons.scss and took out the $icon_path or whatever it was and replaced it with "../assets/bootstrap/
Fixed the problem thereafter.
I had the same problem like you. After some research these are the most important things i found out:
1) Since bootstrap-sass version 3.2.0 the asset directory moved from vendor/assets to assets/
source: Issue with upgrade to bootstrap-sass 3.2.0
2) The font files from customizer are probably corrupted and should be downloaded directly from the Bootstrap homepage.
source: Bootstrap 3 Glyphicons not working
As you already said; change the version back to 3.1.1.1 should do the trick. I uninstalled the gem via:
gem uninstall bootstrap-sass
Then I changed the version defined in the gemfile and reinstalled it with
gem install bootstrap-sass
bundle update
This might help people facing the same issue.

Where are the gem files located?

Where are the gem files located ?
I'm new to rails and trying o understand how the whole gem functionality works.
My question is how can i follow a gem installation in order to confirm a gem is been installed ?
Where are the installed files located ?
From within your rails app, you can list out all of the gems being used, their versions, and the local path:
bundle show --paths
There's no reason to modify any of these files though. Configuration is typically done through an initializer in /app/initializers, but it depends on the gem being used.
If you need to modify something about the gem, you should fork it on Github and then reference the git location in your Gemfile until your pull request makes it back into the gem:
gem 'some_gem', '4.1.1', git: 'https://github.com/some_github_repo/some_gem.git'

Rails locations - where do I locate a gem

In Rails -
Where should I locate Gems? I downloaded bootstrap and it's working, as well as a sample Rails app, separately, but I want them to work together. There is a bootstrapped rails gem (http://rubygems.org/gems/bootstrapped-rails) which I downloaded, but I'm unsure as to where I should locate it. Under models?
And how do I make sure I am referring to it? I need to add something in controller as well?
Again, more an answer to the question in the title than to what was intended by the questioner but you can use
bundle show <gemname>
To locate the directory where a gem is installed.
As Dfr mentioned: https://github.com/seyhunak/twitter-bootstrap-rails
Twitter bootstrap isn't anything more than (mostly) a collection of css/js/image files.
Add this to your gemfile
gem "twitter-bootstrap-rails"
run
bundle install
run for simple css
rails generate bootstrap:install static
It should place relevant js and css files into your application.js and application.css files accordingly. (Read more about asset pipeline)
To get you started, in the gem's link under section - "Generating layouts and views", you can see rake tasks to generate sample layouts.
e.g.
rails g bootstrap:layout application fixed
You should now have a twitter-bootstraped application.html.erb file under views/layouts.
To answer the question in the title, you can locate your gems by running gem env in the console. That will give you the specific information about your "RubyGems Environment:" When you run gem install some_gem_name it will add this gem to your system.
However, what it sounds like your trying to do is add a gem to your app. If this is the case you add gems to a rails application's Gemfile.
So using your example, you'd locate your Gemfile and add the following:
gem "bootstrapped-rails", "~> 2.0.8.5"
Once that's done, you run bundle install in your terminal.
I find that a good resource for basic rails information can be found here: http://guides.rubyonrails.org/getting_started.html
The tutorial is short and it will give you a great starting point.

spree_i18n integration

I'm trying to get the spree_i18n gem working, but am not quite getting it.
I've added this to the Gemfile:
gem 'spree_i18n', :git => 'git://github.com/spree/spree_i18n.git'
I'm using RVM, so bundle installed it to:
~/.rvm/gems/ruby-1.9.3-p125#spree/bundler/gems/spree_i18n-e5e3e189c843
instead of the usual location at:
~/.rvm/gems/ruby-1.9.3-p125#spree/gems/
so I'm not sure if RVM is doing something weird.
But running any of the rake spree_i18n:xxx commands results in the following error:
'Don't know how to build task 'spree_i18n:new'
I'm guessing it's because the gem isn't getting picked up by rake and the app. I was thinking that the app should have picked up on the .yml translation files from the gem folder so I would not need to copy them over to the main app folder.
As a quick fix, I copied over the .yml files from the gem folder to the app config/locales folder. It works but definitely feels like a hack.
Can someone please point me in the right direction to integrate this gem correctly?
I've also posted the question here, in case, there's additional information that might help to solve this.
https://groups.google.com/forum/?hl=en&fromgroups#!topic/spree-user/6ycWGfm6eTk
Thank you for your time!
see related closed issue on github
https://github.com/spree/spree_i18n/issues/171

Resources