Changing the font around a link_to

Hi,

Before I migrated over to the link_to tag, I had the following:

<a href="myreports.html"><font color="#8C9BC9">view all reports</

</a>

I tried to do this:

<font color="#8C9BC9"><%= link_to 'my reports', :action => 'my_reports', :id => session[:user_id]%>

which doesn't work, unfortunately.

I already have CSS governing how links are display and I only wanted to change this particular one. Is there an easy way to accomplish this?

Thanks,

Scott

Before I migrated over to the link_to tag, I had the following:

<a href="myreports.html"><font color="#8C9BC9">view all reports</ ></a>

I tried to do this:

<font color="#8C9BC9"><%= link_to 'my reports', :action => 'my_reports', :id => session[:user_id]%>

which doesn't work, unfortunately.

I already have CSS governing how links are display and I only wanted to change this particular one. Is there an easy way to accomplish this?

inline css would do ya:

<%= link_to 'my reports', {:action=>'my_reports', :id=>session[:user_id]}, {:style=>'text=#8c9bc9'} %>

note you're encoding an id parameter in your URL that's already present in the user's session. That would seem to be redundant and possibly a security problem if you don't check in the controller that the id in the URL matches the authenticated user's id.

- donald

or better than that,

<%= link_to 'link here", :action =>'whateverrrr', :id =>session[:user_id], :class=>'whateverrr-link' %>

now in your css(at the top) you might have a generic class for all anchors like

a { text-decoration: none; color: black; }

but you can also later in your css document you can also go

a.whateverrr-link{ color: #ccc; }

and this will only over ride the color of that anchor, the nice thing is that if you need to add more styles later you can just add them to that class in the css or if you need to add another link with the same style you can just give it the same class name.

Cam

Sorry but that didn't work.

Thanks for pointing out the id passing that didn't need to be.

Cheers,

Scott

Nope, that didn't work, either. I added in just as you did to the end of my css file and altered the class and it didn't help.

Any ideas?

Thanks,

Scott

Turned out there was some other CSS overriding an inner div that was causing the problem.

Thanks to all of you for pointing me in the right direction.