Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Store settings at the user level in a Radiant project
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
config
db/migrate
features/support
lib
spec
README
Rakefile
cucumber.yml
radiant-user_attributes-extension.gemspec
user_attributes_extension.rb

README

= User Attributes

Radiant has a config system to configure an entire site. These settings live in config/environment.rb

This extension lets you set configure options **on a user**.

Use case:
========================

Extension developers can avoid creating a migration that adds new fields to User.

This especially applies to when you have to write a custom Dashboard, for
example with Saturn Flyer's Dashboard extension
(https://github.com/saturnflyer/radiant-dashboard-extension)


How to use it
======================

This extension adds a field to user named user_attributes. It's a Rails serialized_field
(meaning that it will serialize whatever you give it into YAML). 

Each save this extension checks, and if this attribute is nil, it will save an empty hash in the record.

So, to add a "blog location" attribute:

  u = User.find ...

  u.user_attributes["blog_location"] = "ryans_blog"
  u.save!


Created by Ryan Wilcox
Big thanks to Jim Gay
Something went wrong with that request. Please try again.