Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Update Action doesn't work for STI models #52
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
gregbell
May 18, 2011
Contributor
Thanks. We should definitely add STI models to the test suite to make sure we have everything working correctly.
Thanks. We should definitely add STI models to the test suite to make sure we have everything working correctly. |
added a commit
that referenced
this issue
May 26, 2011
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
gregbell
May 26, 2011
Contributor
@tkleft We implemented some cukes to test STI and they all seem to pass. Could you please post the stacktrace and relevant code of the issue you had?
@tkleft We implemented some cukes to test STI and they all seem to pass. Could you please post the stacktrace and relevant code of the issue you had? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
tkieft
May 27, 2011
I actually don't get an error....everything goes well, but the object is never updated.
I patched the update_resource action to do this to fix the problem:
controller do
def update_resource(object, attributes)
object.attributes = params[object.class.to_s.underscore]
run_update_callbacks object do
save_resource(object)
end
end
end
Perhaps it could be fixed upstream too by passing the correct attributes into the function.
Are you able to repro this on your end?
On May 25, 2011, at 7:56 PM, gregbell wrote:
@tkleft We implemented some cukes to test STI and they all seem to pass. Could you please post the stacktrace and relevant code of the issue you had?
Reply to this email directly or view it on GitHub:
gregbell#52 (comment)
tkieft
commented
May 27, 2011
I actually don't get an error....everything goes well, but the object is never updated. I patched the update_resource action to do this to fix the problem: controller do
end Perhaps it could be fixed upstream too by passing the correct attributes into the function. Are you able to repro this on your end? On May 25, 2011, at 7:56 PM, gregbell wrote:
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
tkieft
May 27, 2011
Ah...just looked at your cuke. I think it doesn't cover the case I was using. Let me put what I was trying to accomplish in terms of your models: User and Publisher.
I only have "User" registered with ActiveAdmin, not "Publisher," and I was trying to update a "Publisher" by going to /admin/users/:id/edit, and then save the form. Does that make sense?
tkieft
commented
May 27, 2011
Ah...just looked at your cuke. I think it doesn't cover the case I was using. Let me put what I was trying to accomplish in terms of your models: User and Publisher. I only have "User" registered with ActiveAdmin, not "Publisher," and I was trying to update a "Publisher" by going to /admin/users/:id/edit, and then save the form. Does that make sense? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
Hakon
Jun 25, 2011
say you have the models
class ArticleCategory < Category; end;
and register the active admin panel like this:
when you update an instance of ArticleCategory the form sends an article_category => { :name => "test" } where active_admin expects category => { :name => "test" }.
you can fix this by adding :as => :category to the form.
f.inputs :name
f.buttons
end
Hakon
commented
Jun 25, 2011
say you have the models
and register the active admin panel like this:
when you update an instance of ArticleCategory the form sends an article_category => { :name => "test" } where active_admin expects category => { :name => "test" }. you can fix this by adding :as => :category to the form.
|
tkieft commentedMay 18, 2011
When you edit a model that implements single-table inheritance, the updates are not saved