Displaying 20 results from an estimated 40000 matches similar to: "removing instance variables in partials?"
2009 Feb 06
2
Using partials with form_for
hi all
i was wondering whether it is possible to use partials along with form_for
and form_field. following code is not working. is there some error or this
case is impossible..??
*#new.html.erb*
<h1>Enter Details for new Partner:</h1>
<% form_for(@partner) do |f| %>
<%= render :partial => ''form'', :locals => {:partner => f} %>
<p>
2012 Sep 08
4
dash symbol
In the example below, what is the dash doing between the class
attribute and array:
(field_helpers -
[:label, :check_box, :radio_button, :fields_for, :hidden_field, :file_field]).each
do |selector|
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2011 Jan 05
16
Nicedit (rich text editor)
Hello, I''m trying to use Nicedit to improve my text_areas in some views
of my project.
I have installed jquery:
ruby script/plugin install git://github.com/aaronchi/jrails.git
nicEdit plugin:
ruby script/plugin install
git://github.com/sergio-fry/Simple-nicEdit.git
Add js in layout:
<%= javascript_include_tag ''nicEdit'', ''nicEditInit'' %>
Use it
2010 Aug 23
3
Unable to upload images using native rails file upload
I am a rails newbie and am trying to build my first app. I have a jobs
and categories controller and models respectively.
CONTROLLER:
def new
@job = Job.new
@catergory = Catergory.all
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @job }
end
end
#THIS IS A group of 10 RADIO_BUTTONS TO SELECT A CATEGORY FROM. BY
DEFAULT THE FIRST
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
2010 May 28
8
form helpers don't seem to work with RJS files...
I’ve been spending a great deal of time chasing this problem. Hopefully
someone sees something obvious I’m doing wrong. Basically anytime I try
to call fields_for from an RJS file or within a partial in the RJS file,
I get the following error. My goal is simply to load a partial into a
div. The fields in this partial require fields_for though. And that’s
where the problem lies.
2010 Sep 01
5
validation errors bring up stack trace error page
hello!
I made some custom validations for my app, which do catch invalid data
in the console. However, when I enter invalid data through a form on the
browser view, I get your stack trace error style page (similar to what
you see when you get a syntax error or a nil object) instead of the
nicely styled error messages (what you would see in a scaffolded
application.
First off, what is the stack
2011 Apr 18
2
acts_as_commentable validations
Hi all,
I recently started back up with Rails and things are going well up until
now.
I''ve set up acts_as_commentable in my Post model and it''s working great.
Problem is users are able to create a "blank" comment. I''ve added the
following validations in the comment.rb file generated by
acts_as_commentable to limit the comment length:
[code]
2007 Sep 25
21
form_for and partials
I love form_for, but I really hate
<% form_for :person, @person, :url => {...} do |f| %>
...
<%= render :partial => ''form'', :locals => {''f'' => f}
...
<% end %>
I''ve been thinking of instead allowing
<% form_for :person, @person, :url => {...} do |f| %>
...
<%= f.partial ''form''
2007 Oct 20
14
Problems with form_for and partials
i''m having problem with a form_for situation where i''m trying to DRY
out the repeated parts of my forms and put them in common/form and
render the form elements via another partial in controller_name/_form.
Here''s the first form
# app/views/common/form
<% form_for ... do |f| -%>
<%= render :partial => "params[:controller]/form", :object => f
2011 Sep 13
3
Accessing Rails helper method with_output_buffer
Hi all,
I cannot figure out how to correctly use the with_output_buffer helper
method (located in ActionView::Helpers::CaptureHelper) inside a custom
FormBuilder.
Below follows a simplified example.
I''m trying to achieve the following behavior in an ERB as suggested in
the form_for helper docs in the Rails source:
==========
<%= form_for @object, :builder => MyFormBuilder do
2011 Jul 27
2
rails 3.0.9 usability problem
If there is an error with the submitted password on a form, then both
the password and password confirmation text fields should be highlighted
in red. The default seems to be to highlight only the password field.
Any suggestions on how to correct that? Because rails magically handles
the highlighting, I''m not sure how to intercept that.
--
Posted via http://www.ruby-forum.com/.
--
2011 May 04
1
is not allowed as an instance variable name error
Hey all,
I get error like this:
ActionView::TemplateError
(`@content_for_details_view_builder__-626960428'' is not allowed as an
instance variable name) in app/views/shared/_details_view.haml:
searchlogic (2.4.27) lib/searchlogic/rails_helpers.rb:75:in
`fields_for''
searchlogic (2.4.27) lib/searchlogic/rails_helpers.rb:64:in
`form_for''
2010 Sep 28
4
Unitialized constant controller
Hey guys,
Here''s an error I get after I hit the submit button on the editing
page:
NameError in ClassifiedsController#update
uninitialized constant ClassifiedsController
Help would be appreciated.
Thanks
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this
2010 Mar 20
4
Displaying an image in a Rails form_for
Hi,
I''ve got a public\images\DownArrow.jpg
and app\views\expenses\new.html.erb that want to present this image in
the following context:
<p>
<%= f.label :vendor %><br />
<%= f.text_field :vendor %>
<%= f.image "DownArrow.jpg" %>
<br>
<%= select_tag "test",
options_for_select(@current_vendors.collect {
2010 Jun 08
9
[Rails Heroku] Problem with saving object (on heroku hosting)
Hi All,
I have some strange problem which appears only on heroku hosting 2.3.5
default stack (not on my local computer)
I have some models. Here they are:
class Contact < ActiveRecord::Base
belongs_to :user
belongs_to :type, :class_name => "ContactType", :foreign_key =>
"type_id"
validates_presence_of :name, :on => :create, :message =>
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
2010 Sep 11
10
Having difficulty with threaded comments, using acts_as_tree
I''ve been having problems making threaded comments for the last few
days. Mainly with creating children and displaying the children.
Currently, I have comments shown at the bottom of my articles show view.
The top level comments work, but I do not really know how to implement a
way for users to "reply" to the top level comments and take them to a
form (the comment
2011 Dec 17
7
How to fire Ajax call from Form_for
I am learning Rails 3 and need some help on Ajax part.
I am trying to accomplish the following:
There is a textarea on the page which has a length of letters
constraint, say 100. Every time a symbol is typed there,a nearby label
tells you how many letters you have left.
I plan to use Ajax to do this.
I googled for a few hours and could not figure out how to do this.
So far what I have done is
2011 Aug 31
9
undefined method `model_name' for NilClass:Class in rails 3.0.0
Hi,
i got search which shows following error
ActionView::Template::Error (undefined method `model_name'' for
NilClass:Class):
1: <%= form_for(@employee) do |e| %>
2: EMP ID<%= e.text_field :id %><br>
3: <%= e.submit ''search'', :controller => ''employees'', :action =>
''search1'' %>