RJS not updating styles


I have an RJS tied to periodic update in one of my controllers. I want
the output text to be stylized, so I have the code in the RJS wrapped
in custom style tags:

“<%=h q.text %>” by <%=h q.author %>, <%=h q.year

For some reason, this style isn’t being applied with each periodic
update, although the HTML is definately being updated, as the data is
refreshing, nor is it changing when I change the style in the RJS. I
have also tried applying the style around the div that receives the HTML
injection from the RJS, but that’s not working either.

Here’s the style definition from my css:

LgTextWh {font-size:125%; font-weight: normal; color: white}

[NOTE: these are purposely not children of “body” as I needed more
flexibility in setting text standards.]

And the code around the periodic update in my view:

<%= image_tag "logo.gif" %> <%= periodically_call_remote(:url => {:controller => tasks:action => 'quotes_panel'}, :frequency => 60) %>

and the method that the periodic remote call uses:

def quotes_panel
@quote = Quote.find_by_sql(“SELECT * FROM quotes ORDER BY RAND()
LIMIT 1”)[0]
render :update do |page|
page[‘quote’].replace_html :partial => ‘quote_rand’, :locals => {
:q => @quote}

Thank you very much in advance for your help!


“<%=h q.text %>” by <%=h q.author %>, <%=h q.year

css doesn’t work that way. you can’t define your own tags, you can
create style classes or apply styles to specific elements via the
element itself or an id attribute


/* class style */
.i-am-a-class {
font-size: 1.2em;

/* all h1 tags get this style */
h1 {
font-size: 1.6em;

/* style via id attribute*/
#menu {
text-align: left;



so from what you have posted, you probably want something like:

.LgTextWh {font-size:125%; font-weight: normal; color: white}

“<%=h q.text %>” by <%=h q.author %>, <%=h q.year

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