No commit activity in last 3 years
No release in over 3 years
Ruby on Rails Members engine for Refinery CMS 2.0
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

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.

Install

Open up your Gemfile and add:

gem 'refinerycms-members2'

Run bundle install

Next, to install the members plugin run:

rails generate refinery:members

Note that the above task copies *.refinery_members.rb migration files to your db/migrate directory. 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:migrations to copy engine migration files without a particular order. Since refinerycms-members2 depends 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-members2 and add this gem later, or rename *.refinery_members.rb migrations to follow *_create_pages.refinery_pages.rb migration before running rake db:migrate for the first time.

Finally migrate your database and you're done.

rake db:migrate

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 lib/refinery/members/instance_methods.rb. 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.

Testing

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 Guardfile in spec/dummy and spec_helper.rb in spec/dummy/spec.

rake db:test:prepare

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:

cd ../..

Place your specs in spec directory, as usual. Run the tests as follows:

rake spec

Apparently, one can add the finalizing steps in your Rakefile, by creating refinery:testing:setup_extension task as suggested in lib/refinery/tasks/testing.rake file of refinery-testing gem.

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

Authors