GithubHelp home page GithubHelp logo

Comments (5)

gregbell avatar gregbell commented on May 22, 2024

Thanks. We should definitely add STI models to the test suite to make sure we have everything working correctly.

from activeadmin.

gregbell avatar gregbell commented on May 22, 2024

@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?

from activeadmin.

tkieft avatar tkieft commented on May 22, 2024

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:
#52 (comment)

from activeadmin.

tkieft avatar tkieft commented on May 22, 2024

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?

from activeadmin.

Hakon avatar Hakon commented on May 22, 2024

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

from activeadmin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.