Re: [Rails] collection_select

2017-05-31 Thread Walter Lee Davis
What is the relationship between a club and a press release? Does a club have many press releases? Start with the real-world relationship, then add that relationship to your Rails models. The answer will suggest itself. Walter > On May 30, 2017, at 10:57 PM, fugee ohu wrote: > > I'm creating

[Rails] collection_select

2017-05-30 Thread fugee ohu
I'm creating a new PressRelease the PressRelease model has no club_id column it has columns like venue, venue_city, venue_state, etc. I wanna add a collection_select to the form to get a club_id into the params from the Club model How should my collection_select be constructed I have something

Re: [Rails] collection_select Selected value

2014-01-09 Thread Walter Lee Davis
On Jan 9, 2014, at 8:21 AM, Frederick Cheung wrote: > In general people are moving away from explicit onchange functions. Instead > (using jquery) you'd do somthing like > > $('#a_select_box').on('change', function(){ > //this javascript is called when the drop down with id a_select_box is chan

[Rails] collection_select Selected value

2014-01-08 Thread Himanshu Vikram Tantia
Hello, I'm trying to use collection select to implement filtering for my page. The idea is there are a bunch of posts and I want to implement record filtering for those. The first collection box would have parameters like "Date", "Amount", "Category" and based on the selection of this a second

[Rails] collection_select

2014-01-08 Thread Himanshu Vikram T.
Hello, I'm trying to use collection select to implement filtering for my page. The idea is there are a bunch of posts and I want to implement record filtering for those. The first collection box would have parameters like "Date", "Amount", "Category" and based on the selection of this a secondary

[Rails] collection_select change name

2012-12-28 Thread D2M
Dear All. I use this code for my project, <%= collection_select(:zone_id , :name, @zones, :id, :name,{},{:name=>'normalSelect'}) %> with this. ruby on rails define default name and id. Can i change default name to my custom name. Regards, D2M -- You received this message because you are sub

Re: [Rails] collection_select doesn't populate the drop down list

2012-09-28 Thread Hassan Schroeder
On Fri, Sep 28, 2012 at 7:49 AM, Ke En wrote: > <%= collection_select(:page, :user_id, @users, :id, :full_name, > :include_blank => false) %> > This is the html code that is generated > > > > > > > > > Do those numbers look like valid user_id values? If so, are you sure your U

[Rails] collection_select doesn't populate the drop down list

2012-09-28 Thread Ke En
I'm having an issue using collection_select to create a drop down menu. All the guides say that this <%= collection_select(:page, :user_id, @users, :id, :full_name, :include_blank => false) %> should work but when I run the server, instead of a list of users appearing it's just a blank list. The

[Rails] collection_select issues with rails

2012-04-19 Thread amvis
* data = ActiveSupport::JSON.decode(response.body)* * @catg = data["cat"]* * * i have to populate the dropdown with* id* and *name* from @catg, when i display this @catg i got like this * * [{"created_at"=>"2012-03-31T05:50:27Z", "id"=>1, "name"=>"None", "updated_at"=>"2012-03-31T05:50

[Rails] collection_select

2012-03-28 Thread Sneha Kachroo
_form.html.haml = f.label :Select_Brand, "Select_Brand*".html_safe = collection_select(:brand_name, :brand_id, Brand.all, :id, :name, :prompt => "Select a Brand" ) show.html.haml file %table %tr %td Brand_Name : %td = @message.brand_id After writing this code I am not a

Re: [Rails] Collection_select

2011-10-10 Thread Walter Lee Davis
On Oct 9, 2011, at 11:09 PM, JavierQQ wrote: > Hi, > > I'm new using RoR and I have a ... trouble with > f.collection.select > > What I have in a table is ... for example > group code > GroupA 07A > GroupA 08A > GroupA 10B > GroupB 06A > GroupB 11B > GroupB 07B > GroupC 10A

[Rails] Collection_select

2011-10-09 Thread JavierQQ
Hi, I'm new using RoR and I have a ... trouble with f.collection.select What I have in a table is ... for example group code GroupA 07A GroupA 08A GroupA 10B GroupB 06A GroupB 11B GroupB 07B GroupC 10A GroupC 09A GroupC 09B when I use <%= f.collection_select

[Rails] collection_select problem

2011-01-13 Thread wardenik
Hi, I have the following code: <% @users.each do |u| -%> "> <%= u.name %>,<%= u.member_status_id %> <%= collection_select( u, :member_status_id, @member_statuses, :id, :name , { :class => "select"}, { :name => "member_status_id" } ) %> <% end %> The select is

[Rails] collection_select not being submitted database

2010-07-26 Thread Loic Regnault
Hi everybody, I apologize for my student's english. I got some problem with my Rails app, i got a collection_select who aren't submited & save in my database. After 2 days googling and didn't find anything helpful i'am asking your help. I had two tables: Crc and User: (I removed useless relation

[Rails] collection_select question

2010-06-14 Thread Bee Dubya
Hello! New to ruby on rails, so I hope this isn't a stupid question (great way to start a post ;)). Basically I'm trying to avoid making a bunch of different columns in my db table by having my collection_select concatenate the ID value it returns to a single text field (for instance, the collecti

[Rails] collection_select has_many

2010-03-16 Thread tom
hi i have two models: GeoRegion & GeoRegionSub which have a has_many relation to each other. how can include the has_many relation in the collection_select helper? i want to have that dropdown where the parent is in black and the children indented. <%= collection_select :dl,:parent_id, GeoRegio

[Rails] Collection_select with has_one association

2010-03-06 Thread Greg Ma
Hi, I try to create a select menu with all the city available in my shop form. I've been able to populate the select menu but the city_id isn't stored in the shop table. There must be an error in my view regarding that i'm not sure to understand each parameters of the collection_select. Shop.rb c

[Rails] collection_select not working for nested forms

2010-02-21 Thread Aakash Dharmadhikari
hi guys, Ruby 1.8.7 Rails 2.3.5 I have a nested form in which a select drop down works fine for creating the model, but on edit form it does not show the current value. It gets set to the default option. The domain is like this: Listing Address Neighbourhood The drop down used

[Rails] collection_select

2010-01-28 Thread Steve Castaneda
I'm rendering my form in a partial, as below: ... <%= f.collection_select :color_id, @colors, :id, :name, {:include_blank => false, :prompt => 'What color?'} %> ... Now, I'm rendering this partial in both the new and edit methods of my controller. Everything works great, except for one caveat.

[Rails] Collection_select and has_many :through

2009-10-22 Thread BenR
I am having a bit of an issue with updating multiple models from one form - and in particular the collection_select related to a has_many through relationship. I have the following models: (Location is a pseudo-class which really acts as the join model for the others.) class Location < ActiveRec

[Rails] collection_select fails to work for "edit" but works great for "new"

2009-10-20 Thread ct9a
Hi, all, I setup a drop down box that has data populated by the database. This is for a simple application where by I am trying to add a new "Part". A part has a category and sub category. The latter is optional. When a category has been selected, an ajax query is made to the database backen

[Rails] Collection_Select

2009-09-23 Thread Rails ROR
HI Perhaps it is the most simple doubt that i am asking you all. I am really new to rails. I haven't understood much about collection_select. I have posts and author tables. I want the authors in posts. I need a combobox to populate all the authors name How can i do this with collection_sele

[Rails] collection_select on controller update actions

2009-09-16 Thread Tony
When doing a controller update operation, missing parameters are treated as unchanged. This is a great convention but I'm not sure how to handle this when using a collection_select. If a user deselects all items in a the HTML select, nothing is sent on the update action. For example, if 2 items

[Rails] collection_select option with multiple symbols

2009-06-01 Thread Aldo Italo
i have this collection_select: <%= f.label :customer, t('admin.customers.index.items') %> <%= f.collection_select( :customer, @customers, :id, :surname, options = {:prompt => t('admin.customers.index.item') } ) %> and i want to obtain this in my html: .. surname name company

[Rails] Re: Rails collection_select syntax issue

2009-05-30 Thread ReidO
Thank you Matt! This worked nicely. On May 29, 6:26 pm, Matt Jones wrote: > You're probably better off using select_tag, together with > options_for_select here. collection_select appears to be giving you a > bit more magic than you want... > > Example: > > <%= select_tag :county, options_for_se

[Rails] Re: Rails collection_select syntax issue

2009-05-29 Thread Matt Jones
You're probably better off using select_tag, together with options_for_select here. collection_select appears to be giving you a bit more magic than you want... Example: <%= select_tag :county, options_for_select(["Please select a county...", ""]...@counties.map { |c| [c,c]}) %> (change the ent

[Rails] Rails collection_select syntax issue

2009-05-28 Thread ReidO
I'm trying to display unique counties listed in my database in select box for a property database. I've figured out how to do this, but now I can't figure out how to access the selected value of the select. This mainly has do with the way the HTML select name is outputted. My form code, county is

[Rails] collection_select help

2009-04-24 Thread amna
Hi, I'm new at this.. can you please help me.. the drop down menus are fine, however when i click submit the selection is not saved and it tells me that movie and type can't be blank Here is my movie_types controller class MovieTypesController < ApplicationController before_filter :login_required

[Rails] collection_select :selected (to get a default value into

2009-02-06 Thread Steve Davie
I'm getting murdered by this thing! For the life of me, I can't figure it out. I've spent literally days on google. Here's what I would like to do (in rails 2.2.2): <% if params[:cruise_info] %> <%= collection_select :cabin_type, :cabin_type_id, CabinType.find_by_status(1).collect {|ct| ct},

[Rails] collection_select not selecting default value

2009-01-14 Thread Gu stav
Hi, I'm trying to create a dropdown using collection_select. However, I cant seem to get it to select the right option by default. In my controller I have a setup like this: @content = Content.new @content.selection_id = 3 @selections = Selection.find(:all) In my view I have: <% form_for :con

[Rails] collection_select and select_tag help

2009-01-02 Thread Scott Kulik
I have created the following select box which works fine except for the fact if you edit the item it defaults back to N/A instead of selecting the correct location. select_tag("item[location_id]", 'N/A' + options_for_select(@locations.collect{|location| [location.name, location.id]})) Ideally, I

[Rails] collection_select not remembering selected value

2009-01-01 Thread emarthinsen
Hello- I have a form that I'm using form_for on to bind the form to my order object. Within the form, I want to select a product (each order has one product, which makes this easy). In my order and product models, an order belongs_to a product. I didn't specify that a product has_many orders (alt

[Rails] collection_select problem

2008-11-26 Thread Jose vicente Ribera pellicer
Hi, first and foremost sorry if my english is not the best. I want to choose between somo products in a view. I have tickets and i wanna add tickets_products. 1)ruby script/generate scaffold ticket_product name:string 2) rake db: migrate 3) Models-> ticket belongs to ticketproducts and ticketpr

[Rails] collection_select broken in 2.1.x?

2008-11-04 Thread [EMAIL PROTECTED]
Greetings, Can someone verify for me if collection_select is broken in Rails 2.1.x? I have an administrative form where an administrator can update the subscription level of a user. In the partial I say <%= collection_select(:user, :subscriptiontype_id, Subscriptiontype.find(:all), :id, :dropdo

[Rails] collection_select reseting selection whenever page refreshes

2008-09-08 Thread Will
I have a collection_select dialog that I have for selecting Users on a page. I am wanting the selection to remember and display the last selected user from the database. Every time I refresh the page it is going back to its default value even though the data has changed. Is there a way to tell