Displaying 20 results from an estimated 110 matches similar to: "Scoping option_groups_from_collection_for_select"
2010 Sep 17
1
option_groups_from_collection_for_select
Hi,
in my development environment (Ruby 1.87, Rails 2.3.8) the following
code works fine:
<%= select "applicant", "member_1",
option_groups_from_collection_for_select(@topics, :members, :topic, :id,
:name, @applicant.member_1), {:include_blank => true} %>
Producing:
<optgroup label="Clinical Neuroscience">
<option value="1">Prof
2008 Apr 10
3
option_groups_from_collection_for_select with a ActiveRecord::Base single object
Rails documentation gives examples of using
option_groups_from_collection_for_select with two tables/objects.
How could it be done with one?
Example that almost works:
I have a form to enter address from both the United States and Canada.
It has the following:
====new.html.erb====
<%= select_tag(
:state,
option_groups_from_collection_for_select(
State.countries,
:country,
2010 Jun 18
1
[PATCH] option_groups_from_collection_for_select should produce an HTML-safe string
Can somebody please review my ticket:
https://rails.lighthouseapp.com/projects/8994/tickets/4879
It''s a trivial bugfix ("option_groups_from_collection_for_select
should produce an HTML-safe string") before RC, I think.
Cheers,
Wincent
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group,
2009 Apr 03
0
Alpha sorting on both options and groups for option_groups_from_collection_for_select
# How would you best perform a secondary sort on :buildings below?
= ''Building Name''
= select_tag ''building_id'', |
option_groups_from_collection_for_select(Site.all(:order => :full_name), |
:buildings, :full_name, :id, :full_name, nil) |
--
Thanks,
Tyler Arrigoni
President
OneInterface.net Network Engineering, Inc.
7475 North Palm, Suite 105, Fresno,
2006 Jul 14
6
Get a collection through ActiveRecord for using with option_groups_from_collection_for_select
Hello,
I am having some difficulties with ActiveRecord.
What I want to do is to get a collection of SubjectGroups for using
with option_groups_from_collection_for_select
My Code:
========================================
class Subject < ActiveRecord::Base
has_and_belongs_to_many :users
belongs_to :subject_group
end
class SubjectGroup < ActiveRecord::Base
has_many :subjects
end
2006 Sep 29
1
newbie Q: it won't display foreign keys...
I have two tables
CREATE TABLE continents (
id int(11) NOT NULL auto_increment,
name varchar(255) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE countries (
id int(11) NOT NULL auto_increment,
name varchar(255) NOT NULL,
continent_id int(11) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
I generate scaffolds for country and for
2006 Aug 17
1
2 newbie question
Hey all,
I have 2 newbie questions,
1st question:
<%= collection_select (:region, :id, @regionall, :id,
:title,options={:prompt=>"- Select cat -"}) %>
Ignores the :prompt part while options={:include_blank => true} works.
Any idea what I?m doing work with :prompt ?
2nd question:
How can make my collection_selected to display it''s third key by default?
I know it has
2006 Jun 16
0
Getting error on a group select
Hi,
I''m very new with Ruby and Rails. I have read Agile Web Development
with Rails and was trying to create a grouped selection list by
following his example on page 359.
My helper looks like this:
module LoginHelper
AssocOption = Struct.new(:code_name, :display_name)
class AssocType
attr_reader :type_name, :options
def initialize(name)
@type_name = name
2006 Jun 16
0
Getting an error on options_groups_from_collection_for_select
Hi,
I''m very new with Ruby and Rails. I have read Agile Web Development
with Rails and was trying to create a grouped selection list by
following his example on page 359.
My helper looks like this:
module LoginHelper
AssocOption = Struct.new(:code_name, :display_name)
class AssocType
attr_reader :type_name, :options
def initialize(name)
@type_name = name
2009 Mar 26
0
Rails 2.3.2 nested forms, option_groups etc
Working in 2.3.2 and working from the examples in Github for nested
forms, this works fine for simple text fields, or simple selects but
option_groups_from_collection_for_select is a bit more complicated.
The js code he''s used generates a template to be used for each nested
form, but it does it in the simple example by using a f.select helper.
This will generate the correct html for the
2006 Jul 02
0
Problem with select, options_from_collection_for_select for selected items
I''m having problems to make the selected works, i''ve been trying with select
and options_from_collection_for_select.
I''ve tried, :selected, :selected_key, :selected_value, and all i can got
from the doc page (
http://rubyonrails.org/api/classes/ActionView/Helpers/FormOptionsHelper.html#M000399
)
and from wiki.
Code:
select(''informacao'',
2006 Jan 23
3
problem with a selfmade helper method
Hi all,
i tried to set up the helper method "grouped_programs_selector" in
application_helpers.rb. Since i dont have a deep understanding of Ruby
itself, I pretty much copied the Grouped Selection List (Chapter 17, pp.
259, 260) example from Dave & David''s Book.
The optiongroups are properly created by my method, but there are no options
inside. Maybe you can debug this
2006 Feb 04
4
AJAX rendered select doesn''t get submitted
I have implemented the AJAX observe_field to filter the state/province options
in my address form. This works great except when I submit the form, @params
doesn''t contain the select element.
_address_form.rhtml relevant snippet:
<%= collection_select(:address, "country", Country.find(:all, :order =>
"position"), :code, :name, {:prompt => "-- Select
2006 Mar 16
4
calling an actionview method from inside a model
Hi,
I would like my model instance to produce it''s own list of options for
a form select. This is from a product model that has_many variations
def alts_for_select(current_id)
the_map = variations.map{|v| [v.name, v.id]}
options_for_select(the_map, current_id)
end
the model cannot see the options_for_select method
I tried to use
2006 Jun 05
2
dropdown
I''m using a dropdown on my form for a simple cms which displays the
pages from the database. I want to add some options to the dropdown
that are not in the database. Is there a way to do this?
Here''s my code so far:
<p><label for="navigation_link">Link</label><br/>
<%= select("navigation", "link",
2008 Mar 03
9
mutiple select
Hello:
How do i make a mutiple select list for "nomodel" objects?I made that
by using something like:<select name="" multiple="mutiple"><%=option
groups collection for select(....)-%></select>.But when i select mutiple
items and submit them,I can only get one selected item?
Who can help me?
--
Posted via http://www.ruby-forum.com/.
2008 May 15
1
Remove controller name from URL > nested routes
Hi..
There are my nested routes
map.resources :continent do |continent|
continent.resources :land do |land|
land.resources :destination
end
end
By example it generates this url
http://example/continent/azie/land/japan/destination/aomori
I want
http://example/continent/azie/japan/aomori
How can i realize this...?
Grtz...remco
--
Posted via
2006 Aug 16
4
Accessing Constants Declared in Helper Modules
Hello all,
I''m having great trouble accessing a constant declared in a helper for
one of my view templates. I am trying to create a grouped selection list
based on a predefined set of values. Rather than declare this set of
values in the view, I wanted to put it in the helper that automatically
gets included for the view. Unfortunately, it doesn''t seem to work.
All methods
2010 Mar 16
3
collection_select has_many
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, GeoRegion.all.????, :id, :title %>
thx
--
You received this message because you are subscribed
2007 Jul 25
2
Bug: flac --replay-gain thinks that I used --no-padding
If I use flac to encode with the --replay-gain
option, I get a warning about the --no-padding
option...
"NOTE: --replay-gain may leave a small PADDING block even with --no-padding"
...even though I'm not using --no-padding. And the
file does end up with a small padding block, so
changing tags is slow.
I'd fixed this bug in my own copy of flac 1.1.4,
but forgot to submit the