rubygems

gem yank fails “The version does not exist”

浪子不回头ぞ 提交于 2019-12-24 04:46:20
问题 I'm trying to replace a bad version of my gem on rubygems.com, but yanking fails. You can see at https://rubygems.org/gems/v2gpti that the gem does exist at v0.2. Why is this yank failing? ~ $ sudo gem yank v2gpti -v0.2 Yanking gem from https://rubygems.org... The version 0.2 does not exist. ~ $ 回答1: Since you specified a platform for the gem, you also need to specify it when yanking: $ gem yank v2gpti -v0.2 -​-platform universal-darwin-13 See http://guides.rubygems.org/command-reference/#gem

Ruby if condition not working properly in javascript file

不想你离开。 提交于 2019-12-24 02:58:36
问题 Controller: def AjaxView @vars= Var.find(:all,:conditions => { :varName=> "one" },:select=>(params[:col])) @col = params[:col] respond_to do |format| format.js { render :layout=>false } end end AjaxView.js.erb if('<%= @col %>' == 'colName'){ $("#3").text("<%= escape_javascript(render(:partial => "var")) %>"); } else if('<%= @col %>' == 'colName2'){ $("#2").text("<%= escape_javascript(render(:partial => "var1")) %>"); } View Partial: _var.html.erb <%= @vars[0].colName %> _var1.html.erb <%=

will_paginate not showing on the Web…

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 02:18:37
问题 The previous question is here : what is the common practice on limit the result in RoR? Here's the users_controller: def show @user = User.find(params[:id]) @posts = @user.posts.paginate :page => params[:page] respond_to do |format| format.html # show.html.erb format.xml { render :xml => @user } end end and my show.html.erb: <%=h @posts.length %> <%=h @posts.inspect %> <%= will_paginate @posts %> But in the browser, I only get this: 4 [#<Post id: 7, title: "I am a root", description: "what

Bundler: installing a specific .gem file

一曲冷凌霜 提交于 2019-12-24 01:47:28
问题 Is there a way to tell Bundler to install a particular .gem file I have lying around? I have a compiled version of ParseTree that I must use (damn you, Windows!), but didn't want to expand the gem file in order to add a :path => '...' attribute to the 'gem' requirement. 回答1: You could also package your gems with bundle package , which puts all of your gems in the vendor/cache directory of your project. If needed, overwrite ParseTree with your precompiled gem in in that directory. Then, when

Rails - problem installing Spree

拥有回忆 提交于 2019-12-24 01:44:27
问题 I'm having a problem installing Spree in a Rails app. when I run gem 'spree' (as per the instructions on http://spreecommerce.com/documentation/getting_started.html) I get the following error: ERROR: While executing gem ... (RuntimeError) Unknown command spree I have the following Spree gems installed: gem list spree *** LOCAL GEMS *** spree (0.30.1) spree_api (0.30.1) spree_auth (0.30.1) spree_core (0.30.1) spree_dash (0.30.1) spree_promo (0.30.1) spree_sample (0.30.1) when I installed the

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension

£可爱£侵袭症+ 提交于 2019-12-24 01:43:08
问题 To provide some background - I've just downloaded a Git Repo from GitHub, for a friends app and I am attempting to launch it from my Mac ('rails s'). However, I am being hit with the following error // see below // when running 'bundle install'. It seems as if the 'pg' (postgreSQL) gem is having some sort of obscure installation error. Any help would be appreciated! I have tried this command to no avail: $gem install pg -- --with-pg-config= /usr/bin/pg_config/ And here is the error log:

Is it possible to install gem from private gitlab host from Heroku

笑着哭i 提交于 2019-12-24 01:21:55
问题 I have a private gitlab host, which host private codes and project, and I host my app in heroku, in that heroku app, we use Gemfile to manage dependence of that heroku app, one of those dependence is from private gitlab host. so my Gemfile is something like this: gem 'my_greate_gem', '0.0.1', :git => "http://myprivate_gitlab_host/private_gems/my_great_gem.git" It's seems there's not any tutorial mentions about using private gitlab host to hosting gem in Heroku, but I really don't want to use

How to include assets from one gem inside another gem?

安稳与你 提交于 2019-12-24 00:47:36
问题 I'm building a gem - a Rails engine - let's call it my_new_gem - and inside of my_new_gem I'm trying to include JavaScript assets from another gem - let's call it the_other_gem . In the gemspec for my_new_gem I've included the_other_gem using add_dependency : Gem::Specification.new do |s| s.name = 'my_new_gem' s.version = '0.0.1' s.date = '2019-11-12' ... s.add_dependency 'the_other_gem' end And then in the app/assets/javascripts/my_gem.js in my_new_gem I have required the JS from the_other

Rails 3: How to intercept any http request

坚强是说给别人听的谎言 提交于 2019-12-24 00:23:55
问题 Lets say I have an image at app/assets/images/privateimages/myrestrictedimage1.jpg If I try to go directly to the image via url say with something like http://localhost:5555/assets/privateimages/myrestrictedimage1.jpg I am able to view the image. I would like to have a way to inspect any http request to decide if the user is allowed access to it. I know I can use before_filter in controllers to do some preprocessing before continuing onto any of the controller actions but I dont think this

Ruby script cannot locate required gem

社会主义新天地 提交于 2019-12-23 22:51:00
问题 I'm trying to run a Ruby script that has worked fine in the past. I need to use the Mechanize gem, so at the top of the script, it says require 'mechanize' . However, when I try to run the script now, the Terminal output reads: /Users/codebiker/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- mechanize (LoadError) from /Users/codebiker/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require