Rails' client-side-validation form_for error - ruby-on-rails

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.

Related

Paperclip aws-sdk error: uninitialized constant

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

SCRIPT14: Not enough storage is available to complete this operation, ckeditor gem error on IE

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

Is there an updated rails_sql_views gem for rails 3.2?

I need the functionality provided by the rails_sql_views gem. However it looks like the last commit for this gem was made in 2010. Has this project been outdated by a new project? I'd like to find an active gem to use to get this functionality.
http://activewarehouse.rubyforge.org/rails_sql_views/
http://rubygems.org/gems/rails_sql_views
After further research here is a Rails 3 candidate for similar functionality:
https://github.com/bradphelan/Active-Illusion
This is a gem of this blog post:
http://xtargets.com/2011/08/02/tableless-views-with-active-record/
However this solution doesn't seem to be very popular.
schema_plus gem has create_view method that seems compatible (although I'm not familiar with rails_sql_views).
barancw, I needed this gem for our product using Rails 3.2.5, so I forked the repo and updated the necessary pieces. This gem is great for improving the performance of our large database queries, as it reduces the need to load objects into memory. I combined this gem with another optimization: Rails - given an array of Users - how to get a output of just emails?
https://github.com/ryanlitalien/rails_sql_views
Original documentation: http://rubydoc.info/gems/rails_sql_views/0.8.0/frames/index
Please keep in mind the docs are a bit outdated ("require_gem" has been replaced with "gem" and add the gem to your Gemfile as well).

Rails+MongoDB: "No such file to load"

New to MongoDB and trying to get a second test project working. I emphasize second because I'm wondering if that may be part of the problem as in /data/db/ i still have the files for the first proof-of-concept MongoDB <- MongoID -> Rails project that I got up and running without a problem a few weeks ago.
Now I'm experimenting with building a new Rails project from scratch with some flags (-T -O -J) and then running the associated install/config generators: mongoid:config, rspec:install, jquery:install.
So far so good... until I generate my first scaffold and then try to access it and get the response:
"No such file to load -- vendor"
now, I'm not too surprised as there's no new xxx_development.x files in /data/db/. But I don't remember creating them the first time and tutorials I've been using don't mention such a step? Early onset senility? Or is something amiss? Perhaps MongoDB (or MongoID) can only handle one MongoDB per db directory?!?
#Gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.4'
gem 'mongoid', '2.0.0.rc.7'
gem 'bson_ext'
...
Using default mongoid.yml.
I've searched S.O. for related problems and there were many but most either have problems loading a gem, which is not my case, or state that the bson_ext version must match the mongoid version.. but most of these cases seem old and now I don't even think that's possible with mongoid approaching 2.0 and bson_ext still at 1.2.
Figured it out by building another test app from scratch. there seems to be a bug (or my lack of understanding) somewhere perhaps involved with the -J flag to rails new (or with the combo of using the -J, -T & -O flags at same time?). Anyway, it uncomments the following line in application.rb:
config.action_view.javascript_expansions[:defaults] = %w()
which should read:
config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
adding "jquery rails" made the app work... not sure what the resource name had to do with the original error message!?! Red Herring?

cache_money for Rails 3

I've used various forks (mostly the ngmoco fork) of Nick Kallen's excellent cache_money for several Rails 2.3 based project, but we're now making the leap to Rails 3 which, thanks to the introduction of ActiveRelation, does not work with the popular forks of cache_money.
Is there a fork of cache_money, or an equivalent write-through cache, that is compatible with Rails 3 ?
Last week I launched a new write-through-cache gem for Rails 3, see https://github.com/orslumen/record-cache.
The reason I built it, is because we were using cache money and recently migrated to Rails 3. So chances are it may also serve you well.
There are a branch rails 3 in ngmoco fork to use you :
http://github.com/ngmoco/cache-money/tree/rails3
You can try it I don't know if it's really works.
You can add this in your Gemfile by
gem 'cache_money', :git => 'git://github.com/ngmoco/cache-money.git', :branch => 'rails3'
second_level_cache is also a gem inspired by CacheMoney.

Resources