Closed dfang closed 10 years ago
It checks for roles to validate your access to the admin area.
Have you added any custom functionality to refinerycms-news?
yes, i added a tab to news like refinery-page-images gem did to pages backend, but i can't find the callback.
i know it is something to check permission, but i can' t locate it.
can you help? below is all callbacks for a news item:
> f = Refinery::News::Item.first
> f._destroy_callbacks
=> [#<ActiveSupport::Callbacks::Callback:0x007fec74625288
@callback_id=346,
@chain=
[#<ActiveSupport::Callbacks::Callback:0x007fec74625288 ...>,
#<ActiveSupport::Callbacks::Callback:0x007fec745ee300
@callback_id=320,
@chain=[#<ActiveSupport::Callbacks::Callback:0x007fec745ee300 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_translations)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: intege
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_translations">],
@compiled_options="true && (!halted && value != false)",
@filter=:remove_from_index,
@kind=:after,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: integer,
@options={:prepend=>true, :if=>["!halted && value != false"], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter=:remove_from_index>,
#<ActiveSupport::Callbacks::Callback:0x007fec745ee300
@callback_id=320,
@chain=[#<ActiveSupport::Callbacks::Callback:0x007fec745ee300 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_translations)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: integer,
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_translations">,
#<ActiveSupport::Callbacks::Callback:0x007fec74ec0a00
@callback_id=464,
@chain=
[#<ActiveSupport::Callbacks::Callback:0x007fec74625288
@callback_id=346,
@chain=
[#<ActiveSupport::Callbacks::Callback:0x007fec74625288 ...>,
#<ActiveSupport::Callbacks::Callback:0x007fec745ee300
@callback_id=320,
@chain=[#<ActiveSupport::Callbacks::Callback:0x007fec745ee300 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_translations)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: int
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_translations">],
@compiled_options="true && (!halted && value != false)",
@filter=:remove_from_index,
@kind=:after,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: intege
@options=
{:prepend=>true, :if=>["!halted && value != false"], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter=:remove_from_index>,
#<ActiveSupport::Callbacks::Callback:0x007fec745ee300
@callback_id=320,
@chain=[#<ActiveSupport::Callbacks::Callback:0x007fec745ee300 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_translations)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: intege
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_translations">,
#<ActiveSupport::Callbacks::Callback:0x007fec74ec0a00 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_roles)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: integer,
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_roles">,
#<ActiveSupport::Callbacks::Callback:0x007fec74f42168
@callback_id=490,
@chain=
[#<ActiveSupport::Callbacks::Callback:0x007fec74625288
@callback_id=346,
@chain=
[#<ActiveSupport::Callbacks::Callback:0x007fec74625288 ...>,
#<ActiveSupport::Callbacks::Callback:0x007fec745ee300
@callback_id=320,
@chain=[#<ActiveSupport::Callbacks::Callback:0x007fec745ee300 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_translations)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: int
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_translations">],
@compiled_options="true && (!halted && value != false)",
@filter=:remove_from_index,
@kind=:after,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: intege
@options=
{:prepend=>true, :if=>["!halted && value != false"], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter=:remove_from_index>,
#<ActiveSupport::Callbacks::Callback:0x007fec745ee300
@callback_id=320,
@chain=[#<ActiveSupport::Callbacks::Callback:0x007fec745ee300 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_translations)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: intege
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_translations">,
#<ActiveSupport::Callbacks::Callback:0x007fec74ec0a00
@callback_id=464,
@chain=
[#<ActiveSupport::Callbacks::Callback:0x007fec74625288
@callback_id=346,
@chain=
[#<ActiveSupport::Callbacks::Callback:0x007fec74625288 ...>,
#<ActiveSupport::Callbacks::Callback:0x007fec745ee300
@callback_id=320,
@chain=[#<ActiveSupport::Callbacks::Callback:0x007fec745ee300 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_translations)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id:
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_translations">],
@compiled_options="true && (!halted && value != false)",
@filter=:remove_from_index,
@kind=:after,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: int
@options=
{:prepend=>true, :if=>["!halted && value != false"], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter=:remove_from_index>,
#<ActiveSupport::Callbacks::Callback:0x007fec745ee300
@callback_id=320,
@chain=[#<ActiveSupport::Callbacks::Callback:0x007fec745ee300 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_translations)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: int
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_translations">,
#<ActiveSupport::Callbacks::Callback:0x007fec74ec0a00 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_roles)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: intege
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_roles">,
#<ActiveSupport::Callbacks::Callback:0x007fec74f42168 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_roles)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: integer,
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_roles">,
#<ActiveSupport::Callbacks::Callback:0x007fec7889ad70
@callback_id=616,
@chain=
[#<ActiveSupport::Callbacks::Callback:0x007fec74625288
@callback_id=346,
@chain=
[#<ActiveSupport::Callbacks::Callback:0x007fec74625288 ...>,
#<ActiveSupport::Callbacks::Callback:0x007fec745ee300
@callback_id=320,
@chain=[#<ActiveSupport::Callbacks::Callback:0x007fec745ee300 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_translations)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: int
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_translations">],
@compiled_options="true && (!halted && value != false)",
@filter=:remove_from_index,
@kind=:after,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: intege
@options=
{:prepend=>true, :if=>["!halted && value != false"], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter=:remove_from_index>,
#<ActiveSupport::Callbacks::Callback:0x007fec745ee300
@callback_id=320,
@chain=[#<ActiveSupport::Callbacks::Callback:0x007fec745ee300 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_translations)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: intege
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_translations">,
#<ActiveSupport::Callbacks::Callback:0x007fec74ec0a00
@callback_id=464,
@chain=
[#<ActiveSupport::Callbacks::Callback:0x007fec74625288
@callback_id=346,
@chain=
[#<ActiveSupport::Callbacks::Callback:0x007fec74625288 ...>,
#<ActiveSupport::Callbacks::Callback:0x007fec745ee300
@callback_id=320,
@chain=[#<ActiveSupport::Callbacks::Callback:0x007fec745ee300 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_translations)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id:
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_translations">],
@compiled_options="true && (!halted && value != false)",
@filter=:remove_from_index,
@kind=:after,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: int
@options=
{:prepend=>true, :if=>["!halted && value != false"], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter=:remove_from_index>,
#<ActiveSupport::Callbacks::Callback:0x007fec745ee300
@callback_id=320,
@chain=[#<ActiveSupport::Callbacks::Callback:0x007fec745ee300 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_translations)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: int
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_translations">,
#<ActiveSupport::Callbacks::Callback:0x007fec74ec0a00 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_roles)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: intege
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_roles">,
#<ActiveSupport::Callbacks::Callback:0x007fec74f42168
@callback_id=490,
@chain=
[#<ActiveSupport::Callbacks::Callback:0x007fec74625288
@callback_id=346,
@chain=
[#<ActiveSupport::Callbacks::Callback:0x007fec74625288 ...>,
#<ActiveSupport::Callbacks::Callback:0x007fec745ee300
@callback_id=320,
@chain=[#<ActiveSupport::Callbacks::Callback:0x007fec745ee300 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_translations)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id:
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_translations">],
@compiled_options="true && (!halted && value != false)",
@filter=:remove_from_index,
@kind=:after,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: int
@options=
{:prepend=>true, :if=>["!halted && value != false"], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter=:remove_from_index>,
#<ActiveSupport::Callbacks::Callback:0x007fec745ee300
@callback_id=320,
@chain=[#<ActiveSupport::Callbacks::Callback:0x007fec745ee300 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_translations)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: int
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_translations">,
#<ActiveSupport::Callbacks::Callback:0x007fec74ec0a00
@callback_id=464,
@chain=
[#<ActiveSupport::Callbacks::Callback:0x007fec74625288
@callback_id=346,
@chain=
[#<ActiveSupport::Callbacks::Callback:0x007fec74625288 ...>,
#<ActiveSupport::Callbacks::Callback:0x007fec745ee300
@callback_id=320,
@chain=
[#<ActiveSupport::Callbacks::Callback:0x007fec745ee300 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_translations)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_i
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_translations">],
@compiled_options="true && (!halted && value != false)",
@filter=:remove_from_index,
@kind=:after,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id:
@options=
{:prepend=>true, :if=>["!halted && value != false"], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter=:remove_from_index>,
#<ActiveSupport::Callbacks::Callback:0x007fec745ee300
@callback_id=320,
@chain=[#<ActiveSupport::Callbacks::Callback:0x007fec745ee300 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_translations)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id:
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_translations">,
#<ActiveSupport::Callbacks::Callback:0x007fec74ec0a00 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_roles)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: int
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_roles">,
#<ActiveSupport::Callbacks::Callback:0x007fec74f42168 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_roles)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: intege
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_roles">,
#<ActiveSupport::Callbacks::Callback:0x007fec7889ad70 ...>],
@compiled_options="true",
@filter="(has_many_dependent_for_roles)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: integer,
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_roles">,
#<ActiveSupport::Callbacks::Callback:0x007fec74a12e40
@callback_id=618,
@chain=[...],
@compiled_options="true",
@filter="(has_many_dependent_for_roles)",
@kind=:before,
@klass=
Refinery::News::Item(id: integer, title: string, body: text, publish_date: datetime, created_at: datetime, updated_at: datetime, image_id: integer,
@options={:if=>[], :unless=>[]},
@per_key={:if=>[], :unless=>[]},
@raw_filter="has_many_dependent_for_roles">]
thanks very much !
Can you share the source code of your application? It would be easier to understand what's going on.
@ugisozols, sorry, i can't share all the code, maybe there's a bug in refinery-page-images, i just change destroy to delete to avoid callbacks ...
thanks !
Maybe there is in fact a bug in refinery-page-images but it's hard to help debug if we can't see the custom code.
i'm using gem 'refinerycms-news', '~> 2.1.0' and below is a DELETE request in backend:
when i try to destroy a news, why would refinerycms try to load refinery roles?
thanks !