Assiging an attribute in rhtml

This might be a stupid question, but I am quite the noob and I can’t
find it in agile.

I have this in my html:

<%= dynamic content %>

and I want to put

<%= dynamic content %>

so I can put it as a target from another page.

cheers,

Jason

On 12/10/05, Jason [email protected] wrote:

<%= dynamic content %>

<%= dynamic content
%>

jeremyevans0 wrote:

On 12/10/05, Jason [email protected] wrote:

<%= dynamic content %>

<%= dynamic content
%>

Thanks. I’m saying to myself duuuh! Brainfart.

On Dec 10, 2005, at 3:06 PM, Jason wrote:

Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Try this:

<span class=‘class’ name=<%= @ruby_variable %> ><%= dynamic content
%>

-Ezra Z.
WebMaster
Yakima Herald-Republic Newspaper
[email protected]
509-577-7732

I’m a noob also. I believe the answer is to rap the @ruby_variable
in the erb delimiters so

name=<%[email protected]_variable %>

bruce

You should quote the name. Avoid problems and make “good” html.

 <span class='class' name='<%= ruby_var %>'><%= dynamic content 

%>

My current project uses many of these for using same structure with
different
classes:

 <span class='<%= class_var %>' id='<%= id_var %>'><%= dynamic 

content
%>

Also: ‘id’ should generally be used rather than ‘name’. I believe it’s
safe
to say that ‘id’ will respond
everywhere ‘name’ would, plus ‘id’ can be used as an object: xyz.style…
(But sometimes I use the same ‘name’ for multiple objects to do group
operations: document.all(‘myButtons’).style…)

Rich C.

----- Original Message -----
From: “Bruce B.” [email protected]
To: [email protected]
Sent: Saturday, December 10, 2005 4:37 PM
Subject: Re: [Rails] assiging an attribute in rhtml

brucebalmer wrote:

I’m a noob also. I believe the answer is to rap the @ruby_variable
in the erb delimiters so

name=<%[email protected]_variable %>

bruce

hey bruce, the solution jeremy posted works. I had thought that putting
putting ruby code <%= @variable %> in quotes ‘<%= @variable %>’ would
force a string and not ruby.

But that works.

By way of correction of myself…

Also: ‘id’ should generally be used rather than ‘name’. I believe it’s safe
to say that ‘id’ will respond everywhere ‘name’ would…

You still need to use ‘name’ in form variables, ‘id’ is not adequate.

<input type=text NAME=whatever…

Rich C.

----- Original Message -----
From: “Rich C.” [email protected]
To: [email protected]
Sent: Saturday, December 10, 2005 6:46 PM
Subject: Re: [Rails] assiging an attribute in rhtml

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs