I'm currently running into the uninitialized constant Paperclip::Storage::S3::AWS error when I attempt to upload files to my server. I understand this to be typically caused by running an older version of paperclip, before they added support for aws-sdk-v2. The strange thing is that I'm running the latest paperclip version (4.3.1) which, according to its github page, includes aws-sdk-v2 support.
Honestly, I'm not sure what more I can say about this. I checked the error log and the above is the only complaint it has. Do I need to do anything special to run v2 with paperclip? Thanks to anyone who can shine any light onto this matter.
the issue is written here:
http://ruby.awsblog.com/post/TxFKSK2QJE6RPZ/Upcoming-Stable-Release-of-AWS-SDK-for-Ruby-Version-2
try to change your Gemfile to:
gem 'aws-sdk', '< 2.0'
Figured it out with the help of some folks over at github. (See the thread here.)
Basically it seems that paperclip 4.3.1 doesn't entirely support v2 yet. A week after it was released or so, a commit was pushed to the master that gets past this error. It appears not to be perfect but here's how I made it work.
You can specify this particular revision of paperclip to bundler with the following line:
gem 'paperclip', :git=> 'https://github.com/thoughtbot/paperclip', :ref => '523bd46c768226893f23889079a7aa9c73b57d68'
More information on this sort of thing can be found here.
You will need to specify the REGION of your in your paperclip defaults. This can be done by dropping a :s3_region=> 'us-west-2' (or whatever your region is) into your paperclip_defaults. Simply specifying the endpoint or host will not be enough. You can look yours up here.
Also slightly confusing is the error message if the above isn't done properly:
missing region; use :region option or export region name to ENV['AWS_REGION']
I couldn't get the recommended environment variable to work.
The :region option is somewhat misleading as it needs to be written :s3_region
Related
I recently deployed my app to heroku. It uses Devise, which I had to alter the after_sign_up_path so it would redirect correctly to a set page after someone signs up. This works fine locally, but when I deploy on heroku it installs the original unmodified devise gem.
Does anyone know of a way to modify a gem on heroku, or to make it use the modified gem in my vendor folder?
Thanks.
So, in general, it shouldn't be any different deploying your app on heroku than anywhere else.
One difference is that on heroku you're probably running in 'production' environment settings, and locally in 'development'. You can run in production locally too, if that were the issue.
But I don't think it is. When you say you "altered" Devise, do you mean you actually edited the source code inside the Devise gem source itself?
That's not a good practice. When a new version of Devise comes out, perhaps with security patches, what are you going to do? Re-customize the new version? It's not a great maintenance plan. If you really want to do this you can. The best way might be to create a fork of the Devise gem in a git repo (on github or anywhere else), customize that and commit your customizations to the repo, and then point to your customized version of Devise from your own git repo in your Gemfile with gem 'devise', :git => 'http://some.git.repo.clone.url.org'
But it's a bad idea.
Devise probably already supports your use case with configuration, rather than by editing Devise source code. Most experienced devs would consider that a much preferable way to accomplish what you want.
In this case, it looks like you should be providing an after_signup_path method override in your own local app, not modifying the default implementation in devise source. Google for more info, or consult the URL Finks provides in another answer, or post another question specifically asking how to do what you want to do with devise (it's actually nothing to do with heroku), being as specific as possible about what you want to accomplish.
Assuming you forked Devise to your github account, you can point your Gemfile to it by doing this:
gem "devise", :git => "git://github.com/user/devise.git", :branch => "my-awesome-branch"
By the way, I'd recommend you overwrite some devise methods rather than hack the gem but thats just my 2cents.
This may not answer your question but according to devise wiki, you don't have to alter the gem to get the redirect behavior you like, you just need to override the after_sign_in_path_for method in application controller. https://github.com/plataformatec/devise/wiki/How-To%3A-Redirect-to-a-specific-page-on-successful-sign-in-and-sign-out
Example:
def after_sign_in_path_for(resource)
current_user_path
end
I am using client validation rails gem and I got this error. Any idea.....
wrong number of arguments (3 for 2)
Extracted source (around line #1):
<%= form_for #user, :validate => true do |f| %>
Trace of template inclusion: app/views/users/new.html.erb
Rails 4 Support
Thanks to tagliala & bcardarella, the client_side_validation gem now supports rails 4!
After adding
gem 'client_side_validations'
to my Gemfile, it didn't load everything properly.
This may be temporarily, as Rubygems only links the old version.
Instead I had to specify the exact repository & branch, since the owner changed.
gem 'client_side_validations', github: "DavyJonesLocker/client_side_validations", branch: "4-2-stable"
Based on https://github.com/bcardarella/client_side_validations/issues/494 it looks like CSV will not support Rails 4 for a little bit longer.
However it also states
I don't see CSV 4.0 coming out for at least 2 months after Rails 4.0 lands (hopefully not that long) as there will be major changes on the JavaScript side of things. Because it will take so longer and people will want a Rails 4.0 compliant version of CSV suggesting they use master branch or perhaps releasing a alpha or pre version to partially satisfy them while we update might be the correct option.
So perhaps try pulling csv right from git? There is a 4.0 beta branch that might be worth trying...
Update
The CSV gem is no longer actively maintained. There are 3 different 4.0 branches on the repository, and the most recently updated of which is 4-0-useable (https://github.com/bcardarella/client_side_validations/branches/all).
Update 2
As #TheChamp says, the CSV gem now supports rails 4.2!
If your using Rails 4 then Client Side validation is outdated. You can check here
http://railscasts.com/episodes/263-client-side-validations?view=comments
and also if you go to the github page
https://github.com/bcardarella/client_side_validations
you can see that it says its no longer maintained.
Alternatively you can try using the CSV gem from this branch, by replacing the CSV line in your Gemfile by this
gem 'client_side_validations', github: "bcardarella/client_side_validations", :branch => "4-0-beta"
Not sure even if this will work though. Since its outdated.
Or you can check this gem out,
https://github.com/kalkov/rails4_client_side_validations
Its just a modified version of Client Side Validations
Have you followed all of the instructions on the github page? If so, have you restarted your server? The install adds an initializer that wont take effect until a server restart.
I'm using ckeditor gem in my rails app and its not working on IE. It gives an error
SCRIPT14: Not enough storage is available to complete this operation.
ckeditor.js?body=1, line 63 character 140
I search it on google and saw some result (http://krasimirtsonev.com/blog/article/CKEditor-Not-enough-storage-is-available-to-complete-this-operation and http://ckeditor.com/forums/Support/Not-enough-storage-error-IE7IE8) but I can not understand how can i implement it on my rails app using gem "ckeditor_rails", "~> 4.0.2". please help!
according to http://krasimirtsonev.com/blog/article/CKEditor-Not-enough-storage-is-available-to-complete-this-operation
how to implement it?
1) please copy vendor/assets/javascripts/ckeditor/ckeditor.js from ckeditor_rails gem to app/assets/javascripts/ckeditor/ckeditor.js of your project.
2) find
if(this.$.createStyleSheet)this.$.createStyleSheet
and replace with
if(false)this.$.createStyleSheet
3) cleanup cache of your browser and restart your server to see if it works.
honestly say, I don't try it for IE. But that's how rails assets pipeline works.
the new release v4.1 also has this piece of code. the bug may not be resolved by CKEDITOR team.
also see https://github.com/tsechingho/ckeditor-rails/issues/17
Gemfile:
gem 'rails', '3.1.0.rc4'
gem 'typus', :git => 'http://github.com/typus/typus', :branch => '3-1-unstable'
Obviously the name of the Git-branch suggests that it's error prone, but I think I might be missing something simple here. According to the documentation rails g typus and rails g typus:migration should be enough to get going.
My problem is that I'm missing the AdminsController, after migrating and navigating to 0.0.0.0:3000 I get greeted by
uninitialized constant AdminsController
and there is no AdminsController.rb in app/controllers. Is this a bug in the 3.1 branch or am I missing something in the documentation?
Teddy bear theory strikes again. Navigating to /admin/session/ greets me with a login page. I get the feeling that navigating to /admin/ should still produce some output and not an error message though.
Looking at the commits it's so bleeding edge that's probably a bug.
I see that you already notified developers by opening a ticket, hopefully they'll look into it soon.
Happens to me also all the time with stuff that is trying to be 3.1 compatible, for which I create a patch when it's possible.
Cheers
Turns out the problem was entirely my fault. I didn't have a clean admin namespace like I should have.
For some reason when I try to do config.gem include for this particular gem package it always says its missing. I tried gem 'xapian-fu' and that works just fine! I am sure its not multi gem repository issue as I use the environment in regular basis and has no problem about this.
OK turns out I figured out the answer myself :P
config.gem 'xapian-fu', :lib=>'xapian_fu'
The problem seems because the lib file is being named with the underscore while the gem itself is named with hyphen.
Glad you figured out the issue, there is a good Railscast about Gem Dependencies that covers the whole config.gem setup in depth.
One additional thing, I'd highly recommend explicitly setting the gem version number you want installed as otherwise you're risking pulling a newer version of a gem that may have compatibility issues.
I wrote xapian-fu and this naming inconsistency is a bug, sorry!
It's fixed in the latest version, so you don't need to specify the :lib option any more (the library is now available as both xapian_fu and xapian-fu).