State machine with rails 3.1 - ruby-on-rails

I want to implement mulistep(wizard type) forms to signup. I used Rails 3.1. I need to achieve with help of state machine, so I can maintain it easily. But I am confused with active-record with state-machine. Could please share resources that help my work.

You can give it a try [ https://github.com/pluginaweek/state_machine/ ]

There are few gems available for the implementation of state machines in Rails.
state_machine: It's the most downloaded gem in this category. But unfortunately this feature packed option is no longer maintained.
aasm: AASM aka ‘acts_as_state_machine’ is the second most popular gem in the list as per the download count goes. AASM is regularly maintained by an active community and comes with a very nice documentation.
You can check this Medium article for more details:
https://medium.com/geogo-in/state-machines-in-rails-5-45259a4f42da

Related

Updated alternative to mongoid_voteable?

I'm looking for some kind of reputation system that allows you to up and down vote posts, and I cam across mongoid_voteable which looks like a good resource, except it doesn't work for rails 4.
Does anybody know any alternative gem, that allows you to do this whilst using mongoid?
I have used this gem (this version from the github repo) in a Rails 4 application.
https://github.com/manusajith/mongoid_vote

Ruby/Rails security alerts

How do Ruby developers keep updated on ruby and rubygem security alerts and updates?. I found out about this today:
https://support.cloud.engineyard.com/entries/22915701-january-14-2013-security-vulnerabilities-httparty-extlib-crack-nori-update-these-gems-immediately
and wonder how developers usually keep up with these types of alerts. Thanks in advance.
For Rails, just register for email updates in the Rails security google group :
https://groups.google.com/forum/?fromgroups#!forum/rubyonrails-security
The Ruby Security Announcements list is specifically for security issues in Ruby and Rubygems.
Also check out the bundler-audit gem to automate this process. It will check your gems for known vulnerabilities and also recommend some improvements regarding the update process in general.
I actually wrote about this a few weeks back. These are the things that I would recommend:
Follow the Ruby and Rails security mailing lists.
Use CVE Reports to get details of security alerts as soon as you can. CVE stands for "Common Vulnerabilities and Exposures" and it's an industry standard reporting mechanism.
Keep your dependencies as up to date as you can. Run bundle outdated to get this information. Keeping your test suite at > 85% is going to make dependency upgrading much easier.
Create a process for your team so you can stay up to date on squashing security issues. I elaborate in the blog post on how to do that.
Use tooling like bundle-audit, AppCanary, Hakiri, or Gemnasium to auto-detect gem security issues. These are easy tools to insert into a CI environment.
I think these two sources should get you that info as soon as it's available. You could also sign up for an account at rubygems.org and add Rails to your RSS feed.
Ruby on Rails on Twitter
Rails core mailing list
Also the Ruby 5 Podcast is a twice weekly resource and only takes 10 minutes of your time per week.
Also, if you find it hard to keep find the time to look for updates or perform the actual update: Use mini habits to e.g. update software every Monday, as I described in the week with a Rails security strategy

Which CouchDB API to use for Rails?

I am currently investigating possible applications of CouchDB on my current project (written in Rails) and would like to get some feedback from people who have actually used these APIs. Which would you recommend and why?
ActiveCouch
CouchFoo
CouchRest
CouchRest-Rails
CouchPotato
The basic layer of CouchRest is probably the best to get started, CouchPotato is the most active for Rails integration, SimplyStored adds some nicities on top of CouchPotato
With Rails 3 use (or at least seriously consider using) CouchRest Model. It appears to be well maintained, since as of this update on 2013/12/19 I see several changes that are only 2 weeks old.
Before considering SimplyStored, you should note that they give this warning on Github:
Development work as stopped as we don't use SimplyStored anymore. Please do not expect any future commits and fixes.
Perhaps someone will pick it up, as it looks very useful.
I am going through the same process. You might find SimplyStored interesting if you haven't already given it a look.
http://github.com/peritor/simply_stored

What rails plugins are good, stable and *really* enhance your code?

Anyone have a list of rails plugins that are both stable and give you enough functionality to be worth the extra effort of supporting?
Edit:
I am mostly interested in the best, most complete list of plugins so I can use it the next I'm starting a rails app. I don't currently need a particular plugin.
You can use bort as reference
Plugins Installed
Bort comes with a few commonly used
plugins installed and already setup.
RESTful Authentication
RESTful Authentication is already
setup. The routes are setup, along
with the mailers and observers.
Forgotten password comes setup, so you
don’t have to mess around setting it
up with every project.
The AASM plugin comes pre-installed.
RESTful Authentication is also setup
to use user activation.
User Roles
Bort now comes with Role Requirement
by Tim Harper. A default admin role is
predefined along with a default admin
user. See the migrations for the admin
login details.
Open ID Authentication
Bort, as of 0.3, has Open ID
integrated with RESTful
Authentication. Rejoice!
Will Paginate
We use will_paginate in pretty much
every project we use, so Bort comes
with it pre-installed.
Rspec & Rspec-rails
You should be testing your code, so
Bort comes with Rspec and Rspec-rails
already installed so you’re ready to
roll.
Exception Notifier
You don’t want your applications to
crash and burn so Exception Notifier
is already installed to let you know
when everything goes to shit.
Asset Packager
Packages up your css/javascript so
you’re not sending 143 files down to
the user at the same time. Reduces
load times and saves you bandwidth.
p/s: agree with #eric, specifics
restful_authentication for sign in, sign out, sign up.
paperclip for file uploads.
rspec and shoulda for testing.
Could you be more specific in what you are looking for? There are so many great plugins for so many different tasks, it's hard to guess the right ones for you.
Try resource_controller. http://jamesgolick.com/2007/10/19/introducing-resource_controller-focus-on-what-makes-your-controller-special
It seriously dries up your RESTful controllers. And is the only plausible way of implementing polymorphic actions that I've come across.
Loads of other good stuff too. Give it a try.
I can imagine why you are asking that. I used to work in a project with more than 20 plugins in use. Sure, it speeded up the development early on, but later debugging became difficult. Also, updating to a new version of Rails was a lengthy process.
My advice is that don't start using a plugin before have a reasonable understanding of how it works and of the trade-offs involved. For small plugins you should probably read the source code. For larger ones, see what other people are saying about them, when the plugin was updated the last time, etc.
For scanning popular plugins, see the most popular github projects. Quite a few of them are Rails plugins.
For me, Haml is excellent. It's not for everyone but if it clicks with you you'll love it. Set aside 30 min and give it a shot. It reduces the clutter in my views by about 50%.
It's easy to install using Rails 2.1+'s gem dependencies :
# environment.rb
config.gem 'haml'
Then:
rake gems:install
Ruby Trends is a good place to check what the most popular plugins/gems/books/practices are. It's like StackOverflow (i.e., voting plugins up/down) but is more fine-grained and has the ability to search/filter.
I my rails time I used http://github.com/mbleigh/acts-as-taggable-on/tree/master with success.

Best plugin for creating a "friends" system/social network for latest Rails?

I'm looking for a Rails plugin that eases the development of a "friends" system or social networking system for the latest versions of Ruby on Rails.
Before anyone says it...I know, I should probably create it myself, from scratch. And I am fully capable of this (I think). I'm just looking for a good plugin that can a.) make life a bit easier for me and b.) give me some ideas for reference.
I tried to make my own authentication system, and did what I thought was okay, but then I switched to restful_authentication and realized how poor my system was in comparison.
Thanks in advance...
U might wanna try Community Engine
from the website
CommunityEngine is a free, open-source
social network plugin for Ruby on
Rails applications. Drop it into your
new or existing application, and
you’ll instantly have all the features
of a basic community site.
it uses engines, easy to change layouts or do modifications
real world example - http://www.weebabystuff.com/
another option I know is Insoshi as Chuck posted
updated : look at this blogpost http://jimneath.org/2008/04/25/building-a-social-network-site-in-rails/
-- Ed :) --
You could look into http://lovdbyless.com/
This is a free open-source Rails social networking app which should give you plenty of ideas and pointers.
Ronald
You HAVE to see this railscasts video.
try acts_as_network plugin
The only one I know of is Insoshi. I haven't used it myself, but it sounds like that's what you're looking for.
I would recommend using OpenID library for rails to handle authentication.
On top of what others have said, there's also acts_as_network. The bonus of this one is that it's a pure plugin (doesn't require engines). Not having to worry about engines is a huge plus. The downside, of course, is that it's not a full fledged social network. It's just a friending plugin for models.
You might want to checkout the Amistad gem. It looks pretty simple and it supports both Mongoid and Active Record.
For avatars i would use avatar and try will-paginate for pagination. other then that i love can_serach to make it alot easier to search in the database.
You should also look at the other gems by technoweenie. There is alot of great stuff there that can help you
I've just been researching this myself and chosen to go with Bort & CommunityEngine
Bort because I am familiar with it already and it provides all you need in user authentication and basic application functionality. Community Engine because it is an Engines based plugin and some aspects of Engines are being merged into Rails 2.3 so I know what I learn will continue to be useful and because CommunityEngine seems more modular while lovedbyess and Insoshi seem more like complete applications and I suspect it would likely be more work to disentangle the features I want from the ones I don't. However, take that with a huge grain of salt since it is just based on high-level quick browse initial impressions.
If you just want an activity feed then there is the activity streams plugin

Resources