Refinery CMS Members
Simple member engine for Refinery CMS. It supports member management and page privilege setting.
This version of
refinerycms-members supports Rails 3.2.x, RefineryCMS 2.0 and above.
Open up your
Gemfile and add:
Next, to install the members plugin run:
rails generate refinery:members
Note that the above task copies
*.refinery_members.rb migration files to your
You should examine
*_create_members.refinery_members.rb file and adjust it (if necessary)
to enable or disable Devise strategies and options that are appropriate for your flavor of members.
WARNING: Rails 3 has a bug (fixed in Rails 4) which causes
rake railties:install:migrationsto copy engine migration files without a particular order. Since
refinerycms-members2depends on the database table generated by
refinerycms-pages, the migrations may be copied in a wrong order and thus will not run. Either start your project without
refinerycms-members2and add this gem later, or rename
*.refinery_members.rbmigrations to follow
*_create_pages.refinery_pages.rbmigration before running
rake db:migratefor the first time.
Finally migrate your database and you're done.
Secrets and Easter Eggs
You might have noticed that a second migration adds "need_login" boolean field to the Refinery CMS pages.
Setting this flag will require all visitors of that page to have a member account.
Otherwise, 404 error page is returned. This filtering is handled in
You may want to check with that implementation should you decide to override it.
The gotcha is: this flag is not accessible out-of-the-box, you will need to edit/override your page editing
template(s) and add it yourself.
Another gotcha is: "need_login" flag does not work for the root page of CMS (which is handled by a dedicated "home" action in Refinery::PagesController). The idea is to give a chance to an unsuspecting visitor to understand what this site is about by providing at least a root page with some info, instead of instantly redirecting them to the login page. If you don't want it, override it.
This section is intended for developers of refinerycms-members2. You may skip it if you just use the gem.
Refinery-members2 uses refinery-testing gem for testing.
Follow the guidelines at http://refinerycms.com/guides/testing to setup the dummy app.
However, I couldn't get
rake spec to work as easily as suggested at the guidelines.
If (after completing all previous steps) you find that
rake spec does not work for you,
here's what you can do:
cd spec/dummy rails g refinery:testing
At this step you should have
Now we're done with the final steps of setting up the dummy app.
You can go back from
spec/dummy to the root directory of your engine:
Place your specs in
spec directory, as usual. Run the tests as follows:
Apparently, one can add the finalizing steps in your
Rakefile, by creating
refinery:testing:setup_extension task as suggested in
How to build this engine as a gem
gem build refinerycms-members2.gemspec gem install refinerycms-members2.gem # Sign up for a http://rubygems.org/ account and publish the gem gem push refinerycms-members2.gem