Questions tagged [collection-select]

143 questions
0
votes
1 answer

Rails Edit/Update action not working with nested models (has_many :through)

The edit/update actions doesn't work. I have three models: document.rb belongs_to :languages has_many :configuration_documents has_many :document_catalogs, through: :configuration_documents accepts_nested_attributes_for…
0
votes
1 answer

Rails Form dropdown select, save to table and display in view

I created a user and program table, and a joined table. Each user has_and_belongs_to_many :programs and each program has_and_belongs_to_many :user. Using dropdown select, I wanted to select a program and save it to the user. But after I save, the…
teresa
  • 356
  • 5
  • 21
0
votes
2 answers

Rails 4 - How to display name of record in index view instead of its id after using collection_select

I have two models, Subject and Course. A Course belongs_to a Subject and a Subject has_many Courses. When creating a new course, I am using collection_select to get all subjects in the database so I can select the Subject which the course belongs…
0
votes
1 answer

Rails Select Drop Down with content from Controller not working

I've got a list of items in a model, Tag, that I want to show in a drop down field. The user will select one, and it will be added to the Chat object. There is a 1:many relationship with Chat::Tags, stored in a Taggings table. So--A user selects a…
Mike Earley
  • 1,223
  • 4
  • 20
  • 47
0
votes
0 answers

Select in rails simple_form gives nil irrespective of option selected

Hi I am using simple_form in building forms. In select menu I get nil value for team_size irrespective of the option choosen by the user. Why does this happen. Could anyone help me out. This is my form: .centric h2 Add new game hr =…
Aditya Y
  • 198
  • 3
  • 13
0
votes
1 answer

Select 2 in Rails not rendering properly

I am trying to implement select2 functionality in my project. It is not rendering properly. I am pasting my code, please tell me where it went wrong
mRbOneS
  • 121
  • 1
  • 14
0
votes
1 answer

Ruby on Rails: collection_select - display something other than text

On Rails 4. I am building a site where you can search graphics/products according to their assigned color scheme. Relevant models: class Product < ActiveRecord::Base belongs_to :color_scheme end class ColorScheme < ActiveRecord::Base has_many…
Rachel9494
  • 849
  • 1
  • 7
  • 27
0
votes
1 answer

Rails collection_select , and value automatically added in textfield

Hi i am currently using Collection_select like so , and as you can see its working properly but i want to make it, so that when i pick 1 item from the Item field that the data from my database , bought price and sold price would automatically be…
user1868185
  • 899
  • 3
  • 9
  • 24
0
votes
1 answer

Rails 4.2 how to use Collection_select with dbms

Hi i have been trying to make a sample inventory system to understand rails more, but the problem is that a lot of video's is a bit messy and i cant wrap my head around how the us and make the associations + the database with the…
user1868185
  • 899
  • 3
  • 9
  • 24
0
votes
1 answer

Rails - Collection_select input showing ID of selection rather then the desired value

I have a rails app in which I have a Project model, a Team model and a User model. I am trying to create a nested form within the Project form using the Team model, and in this nested form I have a collection_select field which allows the user to…
0
votes
1 answer

How can I display only a range of values in a rails form view?

I'm quite new to rails and I have some problem with views...I have among others these three models : reservation,route and stop. When you make a reservation, you have to select the route and the city of departure/arrival. EDIT class Route <…
0
votes
1 answer

Rails 4 collection_select is MVC violated?

I have a small question about collection_select in Rails 4. When we call in the collection_select all the elements of a table example: <%= f.collection_select :category_id, Category.all, :id, :name %> Is MVC violated? In other words: if I have a…
0
votes
1 answer

How to use collection_select with unique values in rails?

How can I have a collection_select with 5 options to chose from and when either one is chosen it cannot be picked again for the next (i.e. if 1 is picked first then only 2,3,4,5 are available to pick from). I have two tables: invoices and…
davefogo
  • 93
  • 1
  • 9
0
votes
1 answer

RoR: How to set the value in a collection_select from the database in the edit view (1:many relation)

I am at the moment creating a complicated rails form for 1:n relationship with nested form and collection select with values from yet another data table. So far, it overwrites the database value with the first entry in the values list of the…
0
votes
1 answer

rails undefined method `map' for nil:NilClass issue

Everything was working until I wanted to add a second collection_select in order to select the location that belongs to the company from the current user in my openings/new view. I read and tried different ways but still not working. Jobdescription…
reme
  • 183
  • 1
  • 1
  • 12