I have a Rails4 app with active_admin
for admins only.i have been using it for quite a long time and has customised it to the way i want and it has always worked but now , it is this little weird issue which i am unable to resolve.
i have a custom action in my controller block inside my admin/hall.rb
model, which is also getting executed as per the server logs which also includes the active_admin layout too BUT on the screen , i cannot see any layout and its just blank but when i use application layout explicitly in the controller block, it works.
ActiveAdmin.register Hall do
controller do
##explicitly add helper to be used by existing partials
helper ApplicationHelper
###DO NOT WORK
#layout 'active_admin' # <-- here
##THE WEIRD PART################
layout 'application' , :except => [:activities] ===> this render the application layout perfectly which i dont want , as i need the active_admin layout
layout 'active_admin' , :except => [:activities] ==> also render the application layout...STRANGE
layout 'active_admin' , :only => [:activities] ==> render the application layout but with only icon and entire page is blank
def activities
@hall = MODEL.find params[:id]
@activities = @hall.get_public_activity
##EVERYTHING BELOW THIS DO NOT WORK, I HAVE TRIED IT
#render :activities, :layout => false
#render :partial=>'admin/halls/activities', :layout => "active_admin"
##render "activities", layout: "active_admin"
end
#######server logs
Processing by Admin::HallsController#activities as HTML
...
...
....
(1.7ms) SELECT COUNT(*) FROM "activities" WHERE "activities"."trackable_id" = $1 AND ("activities"."owner_id" IS NOT NULL) [["trackable_id", 1021]]
PublicActivity::Activity Load (1.5ms) SELECT "activities".* FROM "activities" WHERE "activities"."trackable_id" = $1 AND ("activities"."owner_id" IS NOT NULL) ORDER BY created_at desc LIMIT 50 OFFSET 0 [["trackable_id", 1021]]
User Load (1.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 3]]
Announcement Load (1.4ms) SELECT "announcements".* FROM "announcements" WHERE "announcements"."id" = $1 LIMIT 1 [["id", 1021]]
Rendered public_activity/announcement/_create.html.erb (19.4ms)
Rendered admin/halls/activities.html.erb within layouts/active_admin (27.4ms)
...
...
Completed 200 OK in 681ms (Views: 368.8ms | ActiveRecord: 56.4ms | Elasticsearch: 0.0ms)
Can anyone help me to figure out what is going wrong here.
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire