Class: AdminData::FeedController

Inherits:
ApplicationController show all
Defined in:
app/controllers/admin_data/feed_controller.rb

Instance Attribute Summary

Attributes inherited from ApplicationController

#klass

Instance Method Summary collapse

Instance Method Details

#indexObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/admin_data/feed_controller.rb', line 7

def index
  if params[:klasss].blank?
    render :text => "Usage: http://localhost:3000/admin_data/feed/user replace user with your model name"
    return
  end

  begin
    @klass = Util.camelize_constantize(params[:klasss])
    @title = "Feeds from admin_data #{@klass.name}"
    @description = "feeds from AdminData #{@klass.name}"
    @records = @klass.find(:all, :order => "#{@klass.primary_key} desc", :limit => 100)
  rescue NameError
    render :text => "No constant was found with name #{params[:klasss]}"
  end
end