Prawn gem - Undefined Method 'position' - ruby

Using ruby 2.0.0, I am receiving the following error:
undefined method 'position=' for #<Prawn::Table:0x007fa85cb72850> (NoMethodError)
I've read several posts and 100% of them have pointed to adding this to your gem file and running bundle update:
gem 'prawn', :git => "https://github.com/prawnpdf/prawn.git", :ref => '8028ca0cd2'
However, I still get the same error when I do this versus just using gem 'prawn'.
It's worth noting that my script worked perfectly fine on another machine in another environment, using the same gem file that only had gem prawn in it. I don't recall altering the other environment in any way to make it work, but it's possible that I did.
Any thoughts as to how I can get rid of this error?

Related

payola subscription with rails

I am trying to implement the payola-payment subscription in a Rails project.
I have tried to use the gem payola-payments but after running bundle, I am facing the following error when running rake db:migrate:
NoMethodError: undefined method `event_retriever=' for StripeEvent:Module
Did you mean? event_filter=
I have found a solution that suggests using gem 'payola-payments', :git => 'git#github.com:payolapayments/payola.git', but after that I get a migration error:
NoMethodError: undefined method `[]' for #
Can any one help with this?
Your version of payola-payment has a bug check it here :
github.com/payolapayments
It is suggested to replace
gem 'payola-payments'
with
gem 'payola-payments', :git =>
'git#github.com:payolapayments/payola.git'
in you Gemfile.

how do I require 'rake' to be able to use FileList in .gemspec?

I am using :path => '/path/to/gem' functionality of bundler to build and use a modified upstream gem, which uses Rake::FileList in its .gemspec.
At this stage, the bundle I'm installing is not yet activated, or maybe the order things are installed forbids bundler from using rake.
I am using ruby 1.8.7.
My Gemfile:
source 'http://rubygems.org'
gem "rake"
gem "foreign_gem", :path => '/home/user/src/foreign_gem'
The error I get:
$ bundle install
Unfortunately, a fatal error has occurred. Please see the Bundler
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/home/ilya/src/foreign_gem/foreign_gem.gemspec:11: uninitialized constant FileList (NameError)
from /home/user/.rbenv/versions/1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/specification.rb:426:in 'initialize'
from /home/user/src/foreign_gem/foreign_gem.gemspec:1:in 'new'
from /home/user/src/foreign_gem/foreign_gem.gemspec:1
You should be able to add require 'rake' at the top of your foreign_gem.gemspec file in order to use FileList.
I don't know if this is a best practice, but it should work.

Sinatra and Foursquare - undefined method `web_server'

I'm trying to run a simple Foursquare auth in Ruby with Sinatra. I am using the example here.
When I try to run this code on my local server, I get this error
NoMethodError at /
undefined method `web_server' for #<OAuth2::Client:0x16168bc>
I can't figure out how to fix this... Ideas?
the web_server method was removed in v0.5.0 of the OAuth2 ruby gem.
install a prior version of the gem to make use of the missing method:
gem install oauth2 -v 0.4.1
and modify your script by adding the following line before the require 'oauth2' so it will only accept that particular version of the gem:
gem 'oauth2', '=0.4.1'
edit: looks like the example hasn't been updated for a while -- I forked it and included the above suggested workaround (which has since been merged into the original repository).

How to use compass with rails 3.1

I have searched and searched and all I could see was that to use compass with rails 3.1 was to just edit the Gemfile like so:
gem 'compass', :git => 'https://github.com/chriseppstein/compass.git', :branch => 'rails31'
gem 'sass-rails', "~> 3.1.0.rc"
Yes I understand that but what next? Every tutorial I saw said just that, use that certain fork. But I am still having trouble with using compass with rails 3.1.
I did this:
$ compass init rails . --syntax sass
directory ./app/stylesheets/
create ./config/compass.rb
create ./app/stylesheets/screen.sass
create ./app/stylesheets/print.sass
create ./app/stylesheets/ie.sass
And since 3.1 was using assets now, I just transferred all those files to 3.1. Also, I am using compass-960 plugin, so where do I require it? I tried adding a compass.rb with require 960 and require html5-boilerplate and I still keep getting errors:
Error compiling asset application.css:
NoMethodError: undefined method `Error' for Compass:Module
(in /Users/eumir/rails_apps/kiseki/app/assets/stylesheets/screen.sass)
NoMethodError (undefined method `Error' for Compass:Module
(in /Users/eumir/rails_apps/kiseki/app/assets/stylesheets/screen.sass)):
I tried doing compass compile and it gave me this:
$ compass compile
Nothing to compile. If you're trying to start a new project, you have left off the directory argument.
Run "compass -h" to get help.
As I said, I already edited my compass.rb so I am still stumped as to how to go about with this. Any help?
UPDATE: Seems like there is a better way !
Source: http://spin.atomicobject.com/2011/07/12/sass-sprockets-compass-with-rails-3-1/
UPDATE 2(dec 2, 2011): Chris Eppstein, creator of Compass posted this Github Gist of how to integrate Compass with Rails 3.1: https://gist.github.com/1184843
I now prefer this method over mine, as I noticed a great speed improvement at compilation time when using livereload.
MY METHOD:
(I now consider it deprecated, but maybe it can be useful in some cases, so here it is for reference:)
First, in your Gemfile, add:
gem "compass", "~> 0.12.alpha.0"
And don’t forget to execute a
bundle update
Then, in config/application.rb:
config.generators.stylesheet_engine = :sass
Rename application.css.scss to application.css.sass, or create it, and replace its contents by:
#import compass
#import _blueprint
(If you want to keep the new Rails 3.1 manifest code at the beginning of the stylesheet, you’ll have to replace the ‘/* */’ comments by the sass-syntax version ‘//’ at the beginning of each line)
Now, to test if compass and blueprint mixins work, add some code to the same file application.css.sass:
#import compass
#import _blueprint
body
background: black
+linear-gradient(color-stops(white, black))
+column(5)
Run your rails server with
bundle exec rails server
Load your app in a browser, and visit http://localhost:3000/assets/application.css
If everything went well, you should see the compiled code.
Source:
http://blog.pixarea.com/2011/07/using-compass-blueprint-semantic-and-sass-syntax-in-rails-3-1/
The solutions in the other answers are deprecated with the latest version of Compass, v0.12, which requires an adapter to work with a rails app. The Compass author, Chris Eppstein, has put installation instructions on github:
https://github.com/compass/compass-rails
This adapter supports rails versions 2.3 and greater
Peter Gumeson from the compass users groups pointed me to a fix for this:
https://groups.google.com/forum/#!msg/compass-users/mU5HBt8TCIg/2Rt7iSESTSAJ
Here's his message:
Hi gang. This github issue might help out.
https://github.com/sporkd/compass-html5-boilerplate/issues/19
I am pretty much running everything on edge right now. So my gemfile
looks something like this:
gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sass-rails', '~> 3.1.0.rc2'
gem 'haml', :git => 'git://github.com/nex3/haml.git'
gem 'haml-rails'
gem "compass", :git => "git://github.com/chriseppstein/compass.git", :tag => "0.12.alpha.0"
gem 'compass-html5', :git => 'git://github.com/sporkd/compass-html5.git'
I'm working on the rails generators right now, so it should not be too
far off. But this should at least get you going.
Peter
*changed branches as said by choonkeat
YOu can download the compass directory, dump it in vendor/assets/stylesheets so your directory structure is vendor/assets/stylesheets/compass Then from your main application stylesheets include the compass mixins ass required #include compass/reset;

Problem loading activemerchant using Bundler

I am using Merb. I can't seem to get activemerchant to load using Bundler. All my other gems load fine.
In my Gemfile I am using:
gem 'activemerchant', :require => 'active_merchant'
Here is the relevant error:
uninitialized constant ActiveMerchant::Billing::AuthorizedNetGateway
Anyone run into this or have any ideas?
Thanks ahead of time!
Never mind, I figured it out. The symbol that indicates the AuthorizeNetGateway changed in activemerchant. Just had to update my legacy code.

Resources