I want to compare them: both of gems have advantages and disadvantages.For example in client_side_validations more clear and more Ruby to create custom notifications,BUT I have problems with its installation Can't include js file for client slide validation . It is very big minus for me)
jCheck more beatiful, but I need to use more jQuery to use it.
One more: I can't get where all notifications (jCheck) are stored ?
I want to ask : what gem is better for you ?
Depending upon what version of Rails you are using will determine if you can use ClientSideValidations. I haven't had the free time to complete the Rails 3.2 update. Very sorry.
Related
I am relatively new to web dev and I am trying to set up the ruby on rails gem ga_events (https://github.com/Nix-wie-weg/ga_events). I am doing this because I need to have google analytics event tracking within controllers and this gem seems like a good way to do it. The issue I am having is where the readme says, "After requiring ga_events.js, you have to choose an adapter." I am using Google Universal Analytics and thus I would like to choose that one. It doesn't say specifically how to do this. Where do I put that code block (https://github.com/Nix-wie-weg/ga_events#google-universal-analytics-analyticsjs)? Do I need to make a new file somewhere?
I'm assuming it's obvious for a more experienced developer. More detailed instructions+explanation would be really helpful. Thanks.
I'm using Rails 4.0.13 and Ruby 2.0.0p643.
I was having the same issue here! Turns out, it is just javascript code.
I put mine under application.js since it's a code that need to be on every page.
Are there any client-side validation gems similar to client_side_validations (https://github.com/bcardarella/client_side_validations) for Rails 2.x?
I am actually in the process of backporting the current ClientSideValidations gem to Rails 2.x
https://github.com/bcardarella/client_side_validations-rails_2
It's not ready for public consumption yet, but you might want to keep an eye on it. It will inherit from the current gem and add the necessary functionality to Rails 2.x.
Here is a project for client side validations for rails 2, it seems to be the same project that the one you refer but it was left in order to give full functionality to rails 3. There is also an example for rails 2.
I recommend to check a great tutorial using jquery validations with rails.
Hope this helps.
I have a set of functionality that I am considering packaging so as to use them in multiple projects, but I can't decide whether to choose a gem or a plugin. What is the difference? Which one should I choose?
Gem is currently acknowledged as the 'best practice' for Rails. (You can also package as a gem and include an install.rb so that your project can be optionally be installed as a plugin - see this Rails dispatch article).
Basically the only reason to go with a plugin is if your users will want to be able to modify the code more often than not, as it stores a copy in vendor/plugins. However, with the advent of bundler it's pretty simple to store your gems per repository as well and modify them.
If you go with gems, you get the advantages of dependencies, versions, and the functionality that rubygems.org offers for searching, alerts and so on.
Definitely make it a gem!
i am thinking of releasing a rails application as a gem. it's sort of a wiki application which also stores user data in the db directory. what would be a good way to go to avoid the user data being overwritten, when a gem update is done?
example:
1) user gets version 1 of the gem/application. the data is stored in the gem directory.
2) user performs a gem update and gets version 1.1 -> the data is lost! (because there is a second directory now)
my questions are:
does it make sense to package rails applications in gems?
are there example for other rails applications that are packaged as a gem?
how would the problem with the user data be solved?
thanks!
z
I guess using SVN or Git is the best way to distribute and update your application.
Gem is a bad idea for an application.
I would look into Warbler: http://caldersphere.rubyforge.org/warbler/
As a Rails developer I feel a bit stupid asking this question but hopefully I will learn something new and someone can put me out of my misery! In my rails applications I use (other peoples) gems all the time, I also use plugins from the community or my own.
I understand the benefits of use gems over plugins as they are version-able, segmented, system wide, easier to manage and share etc etc but I don't really know how to go about making a gem for my rails apps!?
Do you always start with a plugin and convert it to a gem, I've seen the words 'package it as Gem'. Also the gem I'm thinking of building would be no good in a normal ruby program, it's only useful to rails apps. I'm not even sure if the semantics of that make sense, 'RubyGem' that will only work in a rails application!?
I would like to create a gem (if that's what I should use?) for a discrete piece of functionality for my rails apps. It will need to add a database migration, new routes and provide controllers and views or useful view helpers. I'm know I can achieve this via a plug-in but would just like to know how/why to do it as a 'Ruby Gem'?
To avoid the risk of Over-engineering, I usually start with the feature I need directly into the application. Then, as soon as I need to use the same feature into another project, I check whether it is worth to extract it into a plugin or even a separate application providing an API.
Plugins and Gems are often interchangeable. Gems provides several significant advantages in terms of reusability and maintainability.
On the other side, there are some specific known issue. For instance, a Rails app actually can't load rake tasks defined into a plugin packaged as a Gem.
Almost every Rails plugin can be packaged as a Gem.
For instance, take my tabs_on_rails plugin.
You can install it as a Gem specifying the dependency on environment.rb. Or you can use script/plugin install command as you would expect.
If you want to achieve the same result, make sure to follow the standard Gem layout and provide the init.rb initialization script required by Rails.
Also, you might want to create an install.rb and uninstall.rb file to include the post-install and post-uninstall hooks when the plugin is installed as a standard Rails plugin.
Last but not least, if you package a plugin as Gem you can reuse it in non-Rails projects and provide Rails-specific initializations using the init.rb file. Non-Rails applications will simply ignore it.
If you want to make a plugin for Rails, https://peepcode.com/products/rails-2-plugin-patterns gives you a good start. After that, make the plugin into a gem.
To make a gem, this resource http://railscasts.com/episodes/183-gemcutter-jeweler will be helpful.
As of 2013 you'll want to use Bundler and the following tutorials:
#245 New Gem with Bundler -
RailsCasts
Make your own gem - RubyGems
Guides
Take a look at Jeweler. Jeweler gives you a set of rake tasks to make gem versioning and building very easy.