Top Level Namespace
Defined Under Namespace
Modules: ActiveRecord, Dao, DaoHelper, MongoMapper Classes: APIController, ApiGenerator, Array, DaoGenerator
Constant Summary collapse
- D =
Dao
- Api =
Dao.api do description 'ping!' interface('/ping'){ data.update :time => Time.now } ## this is simply a suggested way to model your api. it is not required. # attr_accessor :effective_user attr_accessor :real_user def initialize(*args) = args.. effective_user = args.shift || [:effective_user] || [:user] real_user = args.shift || [:real_user] || effective_user @effective_user = user_for(effective_user) if effective_user @real_user = user_for(real_user) if real_user @real_user ||= @effective_user end def user_for(arg) User.respond_to?(:for) ? User.for(arg) : User.find(arg) end alias_method('user', 'effective_user') alias_method('user=', 'effective_user=') alias_method('current_user', 'effective_user') alias_method('current_user=', 'effective_user=') def api self end def logged_in? @effective_user and @real_user end def user? logged_in? end def current_user effective_user end def current_user? !!effective_user end end
- ApiController =
rails is a bitch - shut her up
APIController
Instance Method Summary collapse
Instance Method Details
#api(*args, &block) ⇒ Object
59 60 61 |
# File 'lib/dao/rails/lib/generators/dao/templates/api.rb', line 59 def api(*args, &block) Api.new(*args, &block) end |
#tap(value, &block) ⇒ Object
12 13 14 15 |
# File 'lib/dao/stdext.rb', line 12 def tap(value, &block) block.call(value) value end |