Displaying 20 results from an estimated 9000 matches similar to: "same html elements rendering twice on page"
2007 Nov 10
3
Wrapper Helper Help Please
Hi all. I''m hoping this is a simple one that someone can put me right
on.
I have a view that ''wraps'' some div''s around a Page Header and Page
Content, for formatting reasons:
<div id="LHS">
<div class="Page">
<div class="PageHeader">
''Header Here''
</div>
<div
2006 Mar 28
1
simple output string
Hi!
I am new to Rails and wanted to know how I can print an easy
string-line.
I wanted to generate a dynamic title for my blog articles made with
"typo":
The first part of the html-title stays the same:
<title>softrockcookie</title>
if it is not the mainpage ("softrockcookie") it shall add the
page_title, so:
<title>softrockcookie <%= page_title
2007 Sep 30
2
Outputing to the browser, how?
Hello,
I''m writting some helper methods to write forms, so I have this working code:
class TableFormBuilder < ActionView::Helpers::FormBuilder
["file_field", "password_field", "text_field"].each do |name|
define_method(name) do |label, *args|
@template.content_tag(:tr,
@template.content_tag(:td,
@template.content_tag(:label,
2008 Jun 02
1
Looking for help on two issues with Rails 2.1 and RSpec 1.14
I have specs that ran fine in Rails 2.02/RSpec 1.13 that are failing on
Rails 2.1/RSpec 1.14.
There is one problem and one issue:
problem: sometimes (but not always) I get a NoMethodError referencing a
has_many association
issue: in helper specs, instance variables don''t get set unless the
HelperModule is included. Using the preferred helper.<method> I can''t seem
to
2006 Feb 07
3
Newbie help ..
Hi ..
I am new to Rails and it is not clear to me why I am getting the
following error. Any help appreciated.
-m.
$cat app/views/admin/new.rhtml
<% @page_title = "New member..." -%>
<%= start_form_tag( :action => ''create'' ) %>
<table>
<tr>
<td> First Name: </td>
<td> <%= text_field(
2006 Jun 13
7
help with ''error_messages_for''
Greetings,
I''m in the throws of deploying an app on site5, and I''m getting strange
errors. I think I might need to understand how error_messages_for
works.
I get a pretty standard looking error:
"
You have a nil object when you didn''t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occured while evaluating nil.errors
Extracted
2006 Apr 11
1
content_tag can not work?
the tag helper "content_tag" can not work correnctedly on my enviroment:
page.insert_html :bottom, ''body'', content_tag("div","id"=>"tag")
then in body,i can only get "idtag" as the text!
but if i use : content_tag("p","hello world")
I can get it worked. From the rails 1.1 api document,i can find the
2010 Aug 17
3
Rails 3 flash message problems
The following code in my application_helper.rb class either eats the
flash message or escapes it and does not display properly:
# Outputs the corresponding flash message if any are set
def flash_messages
messages = []
%w(notice warning error).each do |msg|
messages << content_tag(:div, content_tag(:p,
html_escape(flash[msg.to_sym])), :class => "message
2006 Jun 19
2
content_tag question
Am trying to insert a link to delete via ajax in my RJS template.
Can one use content_tag and link_to_remote like this in a RJS template?
a = content_tag(''a'', link_to_remote("Delete", :update => "categories",
:url => {:action => "delete", :name => category.name}))
-Thanks.
--
Posted via http://www.ruby-forum.com/.
2007 Jan 24
1
Removing empty class attribute from @template.content_tag
Hey all,
I have a quick question regarding the @template.content_tag methos when
creating a custom form builder.
Currently have the following method in my AccessibleBuilder class:
def datetime_select(field, options = {})
required = options.delete :required
label = options.delete :label
@template.content_tag("div",
@template.content_tag( "span", Example Label ) +
2006 Jul 13
1
From the Agile book, page 144 regarding a div tag helper
Hi. in the Rails Agile book here''s what was happening:
>>>
module StoreHelper
def hidden_div_if(condition, attributes = {})
if condition
attributes["style" ] = "display: none"
end
attrs = tag_options(attributes.stringify_keys)
"<div #{attrs}>"
end
# format_price method ...
end
Note that we cheated slightly here. We copied code from the Rails
2010 Aug 21
4
No route matches?
Hi all,
I''m coming from the PHP world and I''m trying to learn Ruby and Rails.
I''m having a problem where I keep getting the error "No route matches /
home/view" even though I have it defined it. I''d appreciate any help
on this. I''m using rails 3.0 and the setting for the environment is
"development".
# routes.rb
2006 Apr 27
7
HTML Title
Hi there,
If I have an application.rhtml template what''s the best way to set
the contents of title element in the html -> head area of the
template to something set in the view for action in a controller. I
want to just have one template which renders the basic layout for all
pages and I''ve been scratching my head over this one for a couple of
hours now.
Any help
2010 Mar 24
3
flash error & fade away
this is my current code:
#notice {
border: solid 1px #99cc99;
background-color: #e2f9e3;
color: #006600;
padding: 5px;
margin-bottom: 5px;
}
#notice.error {
border-color: #e2f9e3;
background-color: #eeaaaa;
color: #cc0000;
}
<% flash.each do |key, msg| %>
<%= content_tag :div, flash[:error] || flash[:notice], :id => ''notice'',
:class =>
2007 Jun 19
1
javascript_tag replacing whitespaces w/ '%20'
javascript_tag replacing whitespaces w/ ''%20''
Hello,
I have a form that tests if a title has been changed since the page
was loaded and the page has been submitted. If the page title has been
changed then a confirm box will ask if the user wants to have the title
changed. The problem is if the person hits cancel, all white spaces
in the title get replaced w/
2008 Mar 31
2
Rails and Partials
Excuse my ignorance on partials but.....
I am trying to use partials to create a uniform display box built with
html tables. The only way I have thought about accomplishing this is to
create two partials:
_start_box.erb
----------------
<table id="box" width="<%= width %>"><tr><th><%= h(label_text)
%></th></tr><tr><td>
2005 Dec 25
5
RJS not working?
I''ve been attempting to add a simple rjs ''delete'' method to my
project. However, no matter what I try, it simply doesn''t work. Even
the easy, easy stuff seems broken. (Yes, <%=
javascript_include_tag :defaults %> is being included in the template.)
For example, from:
http://www.codyfauser.com/articles/2005/11/20/rails-rjs-templates
VIEW:
<h1
2006 Apr 23
3
custom form builder
In the API docs I found this:
"You can also build forms using a customized FormBuilder class. Subclass
FormBuilder and override or define some more helpers, then use your
custom builder "
I couldn''t find any further documentation on this. Where can I read more
about this formbuilder class? For starters, where would I define a
subclass of this class?
TIA,
Jeroen
--
2012 Mar 16
0
Rails tests failing
http://dl.dropbox.com/u/15024055/CloudShot/shot_15032012_232654.png
if i write the test like this its working just fine it passes green
[code]
it "should have the right title" do
get ''view''
response.should have_selector(''title'',
:content => "View Snippets")
end
[/code]
but for
2007 Dec 02
3
Better way for select list for belongs_to?
I''m currently doing all of this just to have a drop-down list of
Courses for a particular student:
===== edit template =====
<%= f.select :course, @courses, :selected => @student.course.id %>
===================
===== students controller =====
def edit
@student = Student.find(params[:id])
@page_title = "Edit #{@student.full_name}"
@courses =