Giter Club home page Giter Club logo

Comments (5)

rogercampos avatar rogercampos commented on July 23, 2024

best in place already knows that your attribute is a foreign key if you set :type to :select, so instead of ":case_status_id" it must be ":case_status".

To display the value best in place calls your object with that attribute, so the resulting call:
@case.case_status_id

makes no sense and nothing is displayed.

from best_in_place.

ryanharnwell avatar ryanharnwell commented on July 23, 2024

Thanks @rogercampos for your very fast reply.

I think the problem is greater than that. Here is a second example of a field:

<%= best_in_place @case, :case_type, :type => :select, :collection => @types %>

and my case_status re-written:

<%= best_in_place @case, :case_status, :type => :select, :collection => @statuses.map { |e| [e.name, e.id] } %>

In both cases nothing is rendered in the view.

from best_in_place.

ryanharnwell avatar ryanharnwell commented on July 23, 2024

My problem with:

<%= best_in_place @case, :case_type, :type => :select, :collection => @types %>

was that the @types was in the wrong format - I was passing ['New Functionality','Service Degraded','Preventative Maintenance'] instead of [['New Functionality','New Functionality'], ['Service Degraded','Service Degraded'], ['Preventative Maintenance','Preventative Maintenance']]

Now that I understand the format of the :collection parameter I cannot understand why the other field is not working:

<%= best_in_place @case, :role, :type => :select, :collection => Role.all.map{ |e| [e.id, e.name] } %>

from best_in_place.

ryanharnwell avatar ryanharnwell commented on July 23, 2024

I have just modified to:
<%= best_in_place @case, :role_id, :type => :select, :collection => Role.all.map{ |e| [e.id, e.name] } %>

and it works - seems it does need the _id ?

from best_in_place.

ryanharnwell avatar ryanharnwell commented on July 23, 2024

Thanks - ill close this one off.

from best_in_place.

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.