Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Temporary choice remains #206

Open
a-barbieri opened this issue Sep 4, 2018 · 2 comments
Open

Temporary choice remains #206

a-barbieri opened this issue Sep 4, 2018 · 2 comments
Labels

Comments

@a-barbieri
Copy link
Collaborator

Expected behavior

If I create choices from a task I'd expect the temporary choice to disappear and set as default choice only the first choice I explicitly created.

Actual behavior

The temporary choice remains and it's also the default choice.

How to reproduce the issue

If you run this task you should be able to see it

desc "Create a Intro board and relative field settings"
task :create_intro_board => :environment do
  if Binda::Board.where(slug: "intro").any?
    puts "Intro board already exists"
  else
    intro = Binda::Structure.create!(
      slug: "intro",
      name: "Intro",
      instance_type: "board"
    )
    puts "Intro board has been successfully created"
    radio_setting = field_group.field_settings.create!(
      name: "Text color",
      field_type: "radio",
      allow_null: false
    )
    radio_setting.update_attribute("slug", "intro-text-color")
    radio_setting.choices.create!(
      value: "dark",
      label: "Dark"
    )
    radio_setting.choices.create!(
      value: "light",
      label: "Light"
    )
    puts "Intro text color has been successfully created"
    puts ""
    puts "All done!"
  end
end

System configuration

Binda version: 0.1.9

Rails version: 5.1.2

@a-barbieri a-barbieri added the bug label Sep 4, 2018
@a-barbieri
Copy link
Collaborator Author

a-barbieri commented Sep 4, 2018

Also it generates a bug when you try to remove the temporary choice from Binda interface.

schermata 2018-09-04 alle 17 17 15

@a-barbieri
Copy link
Collaborator Author

a-barbieri commented Sep 4, 2018

You are able to delete the temporary choice only changing the current default choice, save and after reloading you can delete it.

This generates another bug because temporary choice is deleted but every component/board still contains temporary choice id reference.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant