Displaying 20 results from an estimated 500 matches similar to: "retrieving value from select"
2006 Jan 09
3
Include with two references of one model of the same table
Hey guys,
I just came across this oddity, not sure what to make of it yet, but
I think it might be incorrect behavior. When doing a @inst.find(:all,
:include => ["hometeam", "awayteam"] ...) hometeam and awayteam are two
references from a belongs_to that is of the same model and of the same
table. I will get a pgerror stating that "matches", which is
2009 Apr 21
2
validates_uniqueness_of
hello all,
i am new to RoR programming and am struck with the functional test whole
checking for uniqeness of carriers. If it is not unique,the the bin
shudn''t be created.Can someone help me in correcting my code.
def test_create_failure_cycle_unique
begin
num_bins = Bin.count
post :create, {:bin => { :carrier => carriers(:A), :cycle =>
cycles(:one), :name =>
2007 Aug 04
1
ActiveRecord gotcha with references?
I have this situation:
class Employee < ActiveRecord::Base
belongs_to :designation
end
class Designation < ActiveRecord::Base
end
I do the following at the irb console:
Step 1: Find an employee
>> emp = Employee.find 3
=> #<Employee:0x35a7d34 @attributes={"designation_id"=>"3", "id"=>"3",
2006 Jan 24
4
How to filter an activerecord find_all...
I have a nice hierarchical table structure like this:
divisions
has_many groups
groups
belongs_to division
has_many subgroups
subgroups
belongs_to group
has_many units
units
belongs_to subgroup
I have a report which is based on units, but i want to be able to filter
the units by which subgroup, or which group, or which division. I also
want to sort them by division.name,then group.name,
2006 Jun 15
0
retrieving parameter or selected value using remote_function
Hi,
Can anyone let me know how to fetch selected option from the following
select box :
<%= select(:category_view,:name,@categories_choices, {:include_blank =>
false},
{:onChange =>remote_function(:update => "div_team_coverage", :url =>
{:action => :set_team_values} ,:with => "category="+ escape(value))} )
%>
<div
2006 Mar 06
2
form_tag error -- not found, 404 -- action DOES exist!
Hi -- I''ve got a very strange error.
I have an action called ''commit_input'' on a controller called
''SiteVisitController''. This definately exists, and is called from the
functional test for it, and passes fine.
My problem is with the form that is supposed to call this action.
The form tag is:
<%=
2006 Feb 21
4
Select error
This code:
<p>
<label for="resource_type">Type</label><br/>
<%= select(:resource, :type, %w{ Web Data }, { :include_blank => true
}) %>
</p>
Produces this error:
TypeError in Resources#new
Showing app/views/resources/_form.rhtml where line #6 raised:
wrong argument type String (expected Module)
Extracted source (around line
2006 Jul 11
0
Please please somebody RESCUE me Reg. form_remote_tag !
Hi frenz,
I need to update "div_main_data" on click of one submit button and I
need to update "div_member" on change of one select option. But couldn''t
find any solution at the moment.
If I use -> :onChange =>''this.form.onsubmit()''
this update the whole "div_main_data" as I couldn''t toggle the update
parameter
in
2006 Jul 11
1
form_remote_tag ISSUE !
Hi frenz,
I need to update "div_main_data" on click of one submit button and I
need to update "div_member" on change of one select option. But couldn''t
find any solution at the moment.
If I use -> :onChange =>''this.form.onsubmit()''
this update the whole "div_main_data" as I couldn''t toggle the update
parameter
in
2006 Jul 12
0
updating two divs based on condition
Hi,
I need to update "div_main_data" on click of one submit button and I
need to update "div_member" on change of one select option within the
same form_remote_tag. But couldn''t find any solution at the moment.
If I use -> nChange =>''this.form.onsubmit()''
this update the whole "div_main_data" as I couldn''t toggle the update
2006 Jul 20
0
Getting joined collections on a form
Greetings, I''m looking for suggestions on how to simplify getting customer
addresses on a form:
I''m jumping between controller and view several times; alternating between
rhtml and rjs, in order to display customers and their addresses on an
invoicing form. It''s very messy.
I have a one to many relationship between Customer and Addresses, each
customer has one or more
2006 Jun 06
0
Get value from form using rjs, and problem with Safari
Hi,
I have got two forms, the first is a textarea plus a link that activates
some javascript to change the form, the second activates some javascript on
the onchange event which changes it into a textarea form.
This works in Firefox, but not in Safari.
Also, I need the value which is selected. I''ve found an example that gives
the parameter to the javascript, like this:
<input
2006 Jun 13
0
Best way to format attributes during visualization/editing
Hi to everyone,
My name''s Carmine and I''m a rails newbie. So, here''s my newbie question
:)
I have a model with one attribute named "kind" of type integer.
This attribute can assume values within the range [0..5].
Each value has a "verbose" representation e.g.: 0 => grain, 1 => liquid
...
To visualize the verbose representation I''ve
2006 May 09
0
Problem with date_select
Dates defined chosen with date_select are not coming through once the
form is submitted.
I have this in a form:
<%= date_select ''search'', ''date_start'', :include_blank => true %>
<%= date_select ''search'', ''date_end'' , :include_blank => true %>
However, when I submit the form params[:search][:date_start]
2006 May 15
0
collection_select and API docs questions
Hello,
I''m wondering where in the docs am I suppose to find a complete list of
options for the collection_select helper?
For instance the API docs have an example for the select helper as
below:
select("post", "person_id", Person.find_all.collect {|p| [ p.name,
p.id ] }, { :include_blank => true })
Where the heck do I find valid values for the options and
2006 Apr 19
2
select_tag and :include_blank => true not working
Guys,
I''m using select_tag to display a non-model dropdown, which works fine.
However, I''ve tried every which way to use the :include_blank => true
option, but it simply won''t display a blank value. Using :include_blank
=> true with select on model fields works fine.
Can someone please show me a working example?
--
Posted via http://www.ruby-forum.com/.
2006 Apr 30
0
populating model attribute from one of many lists
I have a model named Project which contains a name attribute, and I
have a second model named Booking which has, among other things, a
date and a Project. (has_many :bookings, belongs_to :project).
When a user creates a new Booking, they have the option of using an
existing Project or creating a new Project. As an added complexity,
when choosing from existing Projects, they can either choose from
2006 Feb 05
0
How can i specify default time to datetime_select tag
I want to specify a different default time to datetime_select tag how
can i do that.
also i was looking at rails helper code
-----------------------------------------------------------------------
module ActionView
module Helpers
module DateHelper
def to_datetime_select_tag(options = {})
defaults = { :discard_type => true }
options = defaults.merge(options)
2006 Feb 18
0
indexed date_select
Hi All,
I am wondering if it is possible to have date_select fields that are
indexed for updating of multiple rows.
Here is my code:
<% @book.awards.each do |@award| %>
<tr>
<td><%= select("award[]", "category", [ "Fiction", "Non-Fiction",
"Poetry", "First-Boak", "Translation" ],
{ :include_blank
2005 Dec 15
2
Select/Option selected value
I''m trying to get a select box to populate with the current option for editing
purposes. I can populate the box, but not with the currently selected value.
I''ve read in the api where it says to do this:
# Example with @post.person_id => 1:
# select("post", "person_id", Person.find_all.collect {|p| [ p.name,
p.id ] }, { :include_blank =>