Coder Social home page Coder Social logo

Comments (6)

carloslopes avatar carloslopes commented on July 24, 2024

Hi @extrim,

Thanks for open the ticket and this appears to be a bug, for a temporary workaround you can try to define your control this way:

f.select :year, options_for_select((1996..2014).to_a.reverse), nil, :label => 'Some label'

I think this will solve your problem for now, but I'll open an issue on the new repository[1] to fix this.

[1]: We are moving this repo to a new company, you can see more details here: https://github.com/bootstrap-ruby/rails-bootstrap-forms

from bootstrap_form.

potenza avatar potenza commented on July 24, 2024

@carloslopes lemme know what you think of this approach. If you think it's OK, I'll push a bug fix release today.

from bootstrap_form.

carloslopes avatar carloslopes commented on July 24, 2024

For me it's fine, but, I don't understand the necessity of these lines: https://github.com/potenza/bootstrap_form/blob/master/lib/bootstrap_form/form_builder.rb#L125-L131

IMHO, we should get the args passed to the method and extract from it the options after that we extract from the options the bootstrap related ones. These << calls are not clear for me 😕

from bootstrap_form.

potenza avatar potenza commented on July 24, 2024

I added those lines when I was having issues with passing options like include_blank: true or prompt: "Please Select" to select helpers. For instance, collection_select can be called like this (from our tests):

@builder.collection_select(:status, [], :id, :name)
@builder.collection_select(:status, [], :id, :name, prompt: "Please Select")
@builder.collection_select(:status, [], :id, :name, { prompt: "Please Select" }, class: "my-select")

It seemed simpler to 'normalize' the arguments rather than inspecting them to figure out what was sent over. I admit, it's not the clearest approach so I'm open to changing it to something that's easier to understand.

from bootstrap_form.

potenza avatar potenza commented on July 24, 2024

I was thinking that it might be cleaner to use a different define_method block for selects rather than messing with the args. I'll try this out.

from bootstrap_form.

carloslopes avatar carloslopes commented on July 24, 2024

@potenza this is related to my comment here: #8 (comment)

from bootstrap_form.

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.