Displaying 20 results from an estimated 8000 matches similar to: ":locals does not pass var in rails 3.1.0 partial view"
2006 Jun 28
6
select_tag
in my controller
@cursos = Curso.find_all
in my view i''m trying to do a select_tag with the results @cursos, using
a helper
select_tag "name" options_for_select(@cursos) --------> not works
select_tag "name" @cursos --------> not works
how to do it, using the helper?
tks
--
Posted via http://www.ruby-forum.com/.
2009 Jan 08
4
Problem with disable_with
Hi Group,
I have a registration.html.erb page with the following JavaScript at
the top which I use to validate form fields:
<script type="text/javascript">
<!--
function validate(){
if ((document.myForm.email_projectname.value=="")||
(document.myForm.email_projecttype_id.selectedIndex<1)||
(document.myForm.email_region_id.selectedIndex<1))
{
alert
2009 Jul 18
2
Sharing controllers/models within a view
Hello, please forgive me if this answer is obvious! I''m new to Rails
this week.
I have two database tables, and the associated scaffolding, controllers,
models and views. The first is service_provider, which holds a list of
service providers. The second is service_provider_countries which is a
table of countries (obvious perhaps).
In views/service_providers/new.html.erb I have a form,
2012 Jun 09
7
ActiveRecord::AssociationTypeMismatch in UsersController#update
Hi
Im trying to link my User model to a Teams model. I seem to be getting
the following errors. Any help would be great as Im just new to RoR
Thanks
error
ActiveRecord::AssociationTypeMismatch in UsersController#update
Team(#2183395560) expected, got String(#2174675960)
app/controllers/users_controller.rb:67:in `update''
app/controllers/users_controller.rb:66:in `update''
2007 Dec 22
3
collection_select validation problem
I''m trying to assign a parent foreign key value using
collection_select from my child "new" form. The problem I''m having is
if I do not make a selection, I get the following error instead of the
Rails validates_presence_of error:
You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occurred while evaluating
2010 Jun 04
6
Ajax fails in IE8
hi guys,
I am testing a new optional funtionality in my site with IE 8 after
success with Firefox 3.6.3, chrome and safari.
The new functionality basically sees a "sub category" drop down list
get generated in my form as soon as a "Category" value is selected
from the "Category" drop down list.
I have been using the standard rails api such as observe_field, and
2010 Feb 22
3
Rails 2.3.5/Ruby1.8.7 Collection_Select Labels with ampersands "&"
I am having an annoying problem displaying the labels of a select box
correctly where there is an ampersand contained within the label
string.
On a form being rendered with the form_for helper the
collection_select reads data from a Mysql 5.075 database the text
stored in the database is "Surabaya & Surrounding Areas" when rendered
and displayed in firefox 3.6 or safari is is
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/.
2007 Oct 12
6
locals in partials
hiya, in specing a partial, how can i assign a local var that is
normally passed via :locals ? i tried adding :locals => to the render
call but that doesnt seem to take
linoj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071012/fd0acd92/attachment.html
2005 Dec 23
2
Bizarre problems with AJAX / missing variables
I''m having some really weird problems with an app I''m writing.
Everything is working as expected on my development machine (OSX,
Rails 0.14.4) but is cacking out with weird errors on the Textdrive
demo site (FreeBSD, Rails 1.0.0). It complains about missing
variables, with errors like this:
undefined local variable or method `rawcode'' for
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 02
6
remote form w/ evalScripts:true
Hello. I want to select an item from a select list and have that
result in an ajax call that updates two sections on the page. Here is
the code in the controller
def create
...
render :update do |page|
page.replace_html ''list_items'', :partial => ''lists/list_items''
page.replace_html ''add_item'', :partial =>
2006 Apr 06
6
select method
The documentation states as an example:
select("post", "person_id", Person.find_all.collect {|p| [ p.name, p.id ] },
{ :include_blank => true }) could become:
<select name="post[person_id]">
<option></option>
<option value="1" selected="selected">David</option>
<option
2006 Jan 04
5
How do I set the default value for date fields?
I want my date fields to default to NIL or "", because the presence of a
date means something. My problem is that rails is defaulting the fields
to today''s date automatically when I create a new record through the
scaffold. I tried removing the default ''0000-00-00'' and changing NOT
NULL to NULL, but both columns get today''s date as the default
Overriding date_select in local project to use custom value rather than blank for starting option...
2005 May 08
3
Overriding date_select in local project to use custom value rather than blank for starting option...
I would like to have a date control on a page and I would like a
behavior similar to what you get using date_select with the
:include_blank => true option where the first value in the dropdown is
"- Month -", "- Day -", or "- Year -" rather than a blank value for
the respective month, day, and year select fields.
I took a look at the ruby source for
2005 Dec 13
1
Locals and partials
Since i can''t figure out how to use heredocs with erb. im looking at
solving my problem
with partials, but since partials seem to have a completely separate
namespace/scope
im looking for a way to pass the entire scope of the calling rhtml to
the partial.
------------------------------------------------------------------------
Hunter Peress
2012 Aug 16
6
undefined method `with_indifferent_access' for "":String
Hi
I''m having a issue with one object when try to update the attributes in
this object previously saved in the database
I have one object comp and one object reg they have this relationship
comp
has_many regs
reg
belongs_to comp
when run use the method valid? like this
current_contribuyente.comps.build(params[:comp]).valid?
it returns: IndexError (string not matched)
And when
2009 Sep 02
8
select_month helper
I''m trying to rewrite a fusebox-like application (Active4D plugin to
4D database) in RoR/postgres and I''m doing okay - but keep running
into things that stump me. It seems like it takes me hours to figure
out something that I could have written in pure code in minutes.
The select_month and select_day helper has been my latest waste of
time. All I''m trying to do is add
2006 Apr 27
4
select item based on previous select list selection?
So I have a select list with a list of items. When a user selects an
item, another select list should have its default selected item set to a
specific item (the default associated with the first select list).
This is in a form to create a new task. The first select list is a list
of parent tasks. When one selects the parent task, the clients select
list must default to the same client as its
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/.