Changing the font around a link_to


#1

Hi,

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

view all reports</
font>

I tried to do this:

<%= 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


#2

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

#3

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

On Apr 13, 8:28 am, “Ball, Donald A Jr (Library)”


#4

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


#5

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.


#6

Sorry but that didn’t work.

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

Cheers,

Scott

On Apr 12, 3:28 pm, “Ball, Donald A Jr (Library)”