Displaying 20 results from an estimated 1000 matches similar to: "undefined method 'state'"
2010 Feb 10
7
undefined method join
Hey all,
I get an undefined method `join'' for #<String NoMethodError.
student.rb
has_one :student_fail
attr_accessor :student_fail_attribute
#controller
def student_fail
@student = @student.find params[:id]
def update_student_fail
@student.build_student_fail params[:student][:student_fail_attribute]
if @student.save
#view
form_for @student do |f|
2010 Feb 20
3
update user input to another table without using html form
Hey all,
Let''s say you are not going to use an html form. Rather the user will
input data in a third-party application that will communicate with the
rails controller through http requests, but serves as a replacement to
the html. In other words, it''s taking the place of front end.
My question is can you update the attributes of another table, let''s say
studentfails
2010 Mar 09
3
undefined method join for STRING error
Hey all,
I was converting a haml file to erb and when finished, I ran the app
and got this error message:
NoMethodError in Students#student_fail
Showing app/views/students/student_fail.erb where line #40 raised:
undefined method `join'' for #<String:0x105a5e0c8>
Extracted source (around line #40):
37:
38: <% fields << render(:partial =>
2010 Oct 06
7
Passing a hash from the model to the view
I''m trying to display a drop-down menu by using an instance variable
from a model.
THIS WORKS...
<div class="field">
<%= f.label :duration %><br />
<%= f.select ("duration", {"30 minutes" => "30", "1 hour" => "60"},
:prompt => "Select") %>
</div>
THIS DOESN''T
2010 Jan 28
1
validates preference of at least one param
I have a simple RESTful search scaffold that finds data in a separate
model and controller.
[code]
<h1>New search</h1>
<% form_for(@search) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :category_id %><br />
<%= f.collection_select :category_id, Category.all, :id, :name,
:include_blank => true %>
</p>
<p>
Age
2009 Sep 25
12
uniqueness validation perplexity
I want to write a validate routine to check to enforce that a position
must be unique in a category. (In another category, it doesn''t have
to and shouldn''t need to be unique.) I write this code which works
happily for new items:
def position_in_category_not_unique
@items = Item.find( :all, :conditions => [ "category_id = ? AND
position = ?", category_id,
2010 Aug 02
1
Drop down boxes from table data
Hi
I have another question for how best to do this. Now I have been
following the tutorial at:
http://www.tunaslut.com/learning-ruby-drop-down-lists-in-one-to-many-relationships,
however when I change the view over from
<% @cities.each do |city| %>
<tr>
<td><%=h city.city_name %></td>
<td><%=h city.country_id %></td>
to:
<%
2006 Apr 27
3
collection_select to display 2 fields
I''m trying to get a collection_select generated Drop-down box to display
two fields from a table (first name & last name); however, I am having
trouble concatenating the symbols. It appears as though any code I put
in the 5th argument for collection_select is processed prior to
executing the collection_select method. The code executes successfully
with 1 symbol in the 5th
2005 Jan 25
4
Collection_select with multiple options
Hi,
I have built a select field that allows multiple options selected with
collection_select and "multiple"=>"multiple". How do I go about
receiving the values? If I use a variable name like collection[], it
complains that I can''t use @collection[] as the instance variable.
TIA
victor
2006 Mar 07
6
how to add onchange javascript event to select field
I would like to add javascript ''onChange'' event handling for a select
field, such as
<%= collection_select("job", "client_id" , @clients, "id", "name") %>
with onChange="xxx"
Anyone know how to make this work?
Thank you,
Scott
--
Posted via http://www.ruby-forum.com/.
2009 Aug 11
5
Dynamic drop-downs in a form_for using AJAX remote_function - Help
Hello -
I am fairly new to Ruby on Rails, but feel like I am learning quick.
I have what seems to be a fairly unique issue as I cannot find much
out there that describes what I''m seeing. Hopefully it''s a very
simple fix, and I simply can''t see the forest through all the trees!
I am attempting to create 2 related drop-down lists in the same
form_for, both using
2012 Sep 13
3
Creating a link_to from a collection_select
I want to be able to change one attribute of a link_to to be what is the
current selection of the collection_select. And needless to say I can''t
quite figure it out.
app/views/tasks/show.html.erb
Who would you like to assign this task to?<br />
<%= link_to ''Myself'', :controller => ''task_queues'', :task_id => @task.id,
:action =>
2010 Sep 08
4
Populate combo box from database without repeatness
Hi,
I have a column of data with repeated as mentioned below.
*column_name*
Acer
Lenova
HP
Lenova
Acer
Acer
Lenova
I need to populate this column in a combo box without repeated data as
mentioned below
*combo box*
Acer
Lenova
HP
I tried as
<%= collection_select(:column_name, TableName.all)%>
"table_names" is a table and "column_name" is a column needed to
2007 Aug 03
2
Does collection_select work in list.rhtml?
Hi,
I have 2 models:
Model 1: er, Columns: <er_id, er_name>
Model 2: er_process, Columns: <er_id, er_process_name>
er_id is a foreign key for Model 2.
When I am creating a new er_process or editing an existing one, I have
been successful to use collection_select to show the available er''s so
that the user can select a particular er by its name (to populate the
er_id
2006 Nov 29
5
Collection_select with two columns and a prompt
Hello,
I am quite a newbie to RoR, I hope you maybe able to help.
I have a collection_select in a _form.rhtml:
"collection_select(:assets, :model_id, @models, :id,
:model_ref,options={:prompt => ''- Select a model -''})"
As you see my drop down menu will show the model_ref column.
1) Is it possible to have more than one column. For example I would
like to
2009 Jun 14
5
Partials views and instance variables go nil
Hi everyone!
Model: http://pastie.org/511290
Controller: http://pastie.org/511285
View new: http://pastie.org/511286
View _form: http://pastie.org/511284
When I hit submit button there''s an error for usuarios(users in
portuguese) instance. It does not seems to save usuarios even though it
seems to be posted by the form.
Error: http://pastie.org/511292
Need some help here guys plz
--
2011 Aug 11
17
f.collection_select: what are the parameters?
The rails docs are so horrible on the collection_select method. They
need to show a *complete* form, and show two examples: one that calls
f.collection_select(), and another that calls collection_select(), and
explain the differences.
Given this line:
f.collection_select :topic, Topic.all, :id, :category
What the !@#$!@#$ is :topic?
--
Posted via http://www.ruby-forum.com/.
--
You received
2006 Jun 22
2
Setting an index on a collection_select
I am creating a data entry form that allows a user to fill in multiple rows
and save them all at once. In my controller, I create an array of "person"
objects and pass it to the page. On the page, I have a text field like so:
<%= text_field "person", "name", "index" => 1 %>
Note the "index" attribute, which sets the name and id
2006 Jul 16
6
using collection_select
hello,
supposing i have a User class that contains a Wibble
class User < ActiveRecord::Base
has_one :wibble
end
in my view i have
<%= collection_select :user, :wibble, Wibble.find(:all), :id, :name %>
when i post, i get an error like
"Wibble expected, got String"
how/where am I supposed to convert this posted wibble_id into a
Wibble, or am I using collection_select
2006 Jul 20
2
using association properties in form helpers
sorry for the noob question:
how do i reference an association''s properties in a form helper?
e.g. if i wanted to build a select list to choose a user''s address''s
state (user.address.state), how would i hook that to the "method" of
collection_select
collection_select :user, ???, States.find(:all)