Fixed bug which became transparent with rails4 deprecation warning.
Fixed some issues raised by pullreview.com.
Merge branch 'master' into rails4

Conflicts:
	app/models/permission.rb