metamaps--metamaps/app/controllers/main_controller.rb

40 lines
711 B
Ruby
Raw Normal View History

2012-09-23 02:39:12 +00:00
class MainController < ApplicationController
include ItemsHelper
2012-09-23 02:39:12 +00:00
before_filter :require_user, only: [:userobjects]
2012-09-23 02:39:12 +00:00
respond_to :html, :js, :json
def home
@current_user = current_user
2012-10-19 04:06:16 +00:00
@item = Item.all.first
2012-09-23 02:39:12 +00:00
2012-10-19 04:06:16 +00:00
@alljson = @item.all_as_json.html_safe
respond_to do |format|
format.html { respond_with(@item) }
format.json { respond_with(@alljson) }
end
2012-09-23 02:39:12 +00:00
end
def userobjects
@user = current_user
2012-10-18 00:51:54 +00:00
@all = @user.items
respond_with(@all)
end
def usersynapses
@user = current_user
@synapsesjson = usersynapses_as_json(@user).html_safe
respond_to do |format|
format.html
format.json { respond_with(@synapsesjson) }
end
end
2012-09-23 02:39:12 +00:00
end