Displaying 20 results from an estimated 300 matches similar to: "getting multiple select to work: options_for_select"
2010 Sep 08
2
subbing a string vector for another string vector
I have a data frame with two columns:
image pattern
1 http://$IMAGE_ID$ www.url.com/image.jpg
2 $IMAGE_ID$ http://www.blah.com/image.gif
...
I want to replace "$IMAGE_ID$" with the corresponding entry in the pattern
column such that the result would appear as follows:
url
http://www.url.com/image.jpg
2009 Jul 07
2
paperclip unit testing
Hi,
Rails 2.3.2, paperclip 2.2.9.2
How can I unit test my model that has a paperclip attachment?
I add to my model:
--- CODE START ---
has_attached_file :image, :default_url => ''''
attr_protected :image_file_name, :image_content_type, :image_image_size
--- CODE END ---
Than I type a UNIT test:
--- CODE START ---
foo=FooModel.new({:image =>
2006 Sep 03
7
using polymorphic associations with acts_as_list
This is what I have
class Photo < ActiveRecord::Base
belongs_to :image, :polymorphic => true
acts_as_list :scope => image
end
class Place < ActiveRecord::Base
has_many :photos, :as => :image
end
class Child < ActiveRecord::Base
has_many :photos, :as => :image
end
I want to be able to reorder the images. What I need is for the
position of the photos to be set
2006 Mar 20
1
FileColumn question
Can someone please help me with this.
I have an Images table :-
create table images (
id integer unsigned not null auto_increment primary key,
image varchar(200) not null default ''''
)ENGINE=InnoDB default CHARSET=latin1;
And a car table :-
create table cars (
id integer unsigned not null auto_increment primary key,
user_id integer unsigned not null,
title varchar(100) not
2007 Jan 17
2
Effect size in GLIM models
Dear All,
I wonder if anyone can advise me as to whether there is a consensus as
to how the effect size should be calculated from GLIM models in R for
any specified significant main effect or interaction.
In investigating the causes of variation in infection in wild animals,
we have fitted 4-way GLIM models in R with negative binomial errors.
These are then simplified using the STEP procedure,
2006 Jan 31
2
SVM question
I'm running SVM from e1071 package on a data with ~150 columns (variables)
and 50000 lines of data (it takes a bit of time) for radial kernel for
different gamma and cost values.
I get a very large models with at least
30000 vectors and the prediction I get is not the best one. What does it
mean and what could I do to ameliorate my model ?
Jerzy Orlowski
2006 Jan 23
2
problem with options_for_select
Hi All,
I am having a little difficulty using the options_for_select forms
helper method. I have a form for an active record object book, which
belongs to a publisher. Using the options_for_select is working fine
as far as creating the various options, but it will not output the
"selected=''selected''" bit of html needed to identify which publisher
is
2008 Jul 20
1
selected attribute in options_for_select
Hello Everyone
I have a select_tag which I populate using a map, I use
options_for_select method to pass the map and "selected" value. For some
reason I can not get the option "selected" based on the value I pass to
the selected attribute. Here is the code
<%= select_tag :current_course,
options_for_select( Course.find(:all).map {|p| [p.title,p.id]},
@selected )
2006 Aug 09
8
AJAX image manipulation
I have this code in a controller that returns images to my browser...with
ROR.
def index
@products = Product.find_all_ pictures
end
....this is the .rhtml..
<% for photo in @pic -%>
<div class="entry">
<img src="<%= photo.image_url %>"/>
<h3><%= h(photo.title) %></h3>
<%= photo.description %>
2006 Jul 04
1
options_for_select - default nil value
I have a field in a view, like so:
<%= select_tag(''quoted_condition'',
options_for_select([''NEW'',''RETAIL'',''OEM'',''REFURB''], ''NEW'')) %>
This sets the ''selected'' value to ''NEW'' - however, I would like to have
a nil value here, so I can
2008 Jan 03
1
Help using options_for_select in select_tag
<b>Client</b><br />
<%= select_tag ''clients[]'',
options_for_select(
[['' '',''1''], [''aaaa'',''2''],
2007 May 24
1
How do I show the selected values in options_for_select? Not as simple as it sounds.
How do I show the selected values in options_for_select? I have a
Service model and a AccessControl model. When a user edits a Service I
want the services access_controls to be pre-selected.
Models:
Service has_many AccessControls
AccessControl belongs_to Service
application.rb:
$types = Array["Athens", "htpasswd", "IP", "None", "Other",
2006 Jan 14
2
I think options_for_select is backwards
With a hash such as:
stuff = {''1''=>''desc 1'', ''2''=>''desc 2'', ''3''=>''desc 3''}
options_for_select(stuff) will output:
<option id="desc 1">1</option>
<option id="desc 2">2</option>
<option id="desc 3">3</option>
2007 May 21
0
options_for_select and setting css class values
Hi,
i''m not sure if this is possible using erb (at the very least, I can''t
figure it out by googling or via searching this board), so here
goes...
i''m using erb to make a select box with several hundred <option>
values
it looks something like this:
<%= select_tag ''controls'', options_for_select(@controls.map {|cpd|
2007 May 10
0
options_for_select helper is also mess....
I am ''trying'' to use ''options_for_select''
<select name="selected_distance" id="selected_distance"
style="width:8%;">
<%= options_for_select(["2", "5", "10", "15", "25" ], @selected_distance
) %>
</select>
which generates the html....
<select
2010 Jun 17
1
Problem with options_for_select
Hi,
I have a problem with the form select. In the value field I have the
generated html...
<%= f.select :brand_id,
options_for_select([[''Brands'', 0]] +
@search_brands.map { |b| [b.name, b.id]}),
{:id => ''cbxBrand'', :tabindex => (@tabindex += 1)} %>
This is the html:
<select name="search[brand_id]"
2006 Jul 17
6
3 newbie questions
hey all,
I have 3 tables like this:
Images (id,name)
Tags (id,name)
ImagesTags(imageid,tagid)
in my image model I do a "has_and_belongs_to_many :tags" but to make
it work I need to rename ImagesTags(imageid,tagid) to
Images_Tags(image_id,tag_id). My question is that given that I can''t
rename the table, is there any way to make it work with the original
names?
Second question:
2006 Jun 26
0
options_for_select-how to store cookie selected value ques.
#Controller
cookies[:state] = state
if state != nil and state.to_i != -1
conditions << ''stateid = ?''
cond_args << state
cookies[:state] = state
end
if !cookies[:state].blank?
@default_state = cookies[:state]
else
@default_state = ""
end
# view - html
2006 Mar 08
1
question about options_for_select array
Hi!
If i have something like this used to create select tag:
options = [["Dollar", "$"], ["Kroner", "DKK"]]
and later read value from the database and get "DKK", what is the
easiest way to get "Kroner" value?
--
Posted via http://www.ruby-forum.com/.
2010 Mar 24
0
Select_tag with options_for_select not populating DB.
I''m trying to get my animal app to let users populate info about each
animal. The code below partially works. It shows the drop down menu,
and it shows the names of what I wanted it to be the names of the
Databases. I don''t know how to make it work so it shows the name dog
and than you hit submit and it appears in the dog view. When I hit
submit it just makes a new view under the