How to specify css

Hi…
i used paulca-phone_codes plugin for country code.and it works.
<%= f.select :country_code, PhoneCode.options_for_select(:prefix)%>
what i want to know is how to apply css class for this.when i tried like
below it doesnot work
<%= f.select :country_code, PhoneCode.options_for_select(:prefix),
{:class => “mystyle” }%>

Any helps

Newb N. wrote:

Hi…
i used paulca-phone_codes plugin for country code.and it works.
<%= f.select :country_code, PhoneCode.options_for_select(:prefix)%>
what i want to know is how to apply css class for this.when i tried like
below it doesnot work
<%= f.select :country_code, PhoneCode.options_for_select(:prefix),
{:class => “mystyle” }%>

Any helps

try

<%= f.select :country_code, PhoneCode.options_for_select(:prefix),
:style => "class=‘MyStyle’ %>

You can even substitute all of the properties separated by semicolons
(:wink: within the :style => “” parameter.

Ahad A. wrote:

Newb N. wrote:

Hi…
i used paulca-phone_codes plugin for country code.and it works.
<%= f.select :country_code, PhoneCode.options_for_select(:prefix)%>
what i want to know is how to apply css class for this.when i tried like
below it doesnot work
<%= f.select :country_code, PhoneCode.options_for_select(:prefix),
{:class => “mystyle” }%>

Any helps

try

<%= f.select :country_code, PhoneCode.options_for_select(:prefix),
:style => "class=‘MyStyle’ %>

You can even substitute all of the properties separated by semicolons
(:wink: within the :style => “” parameter.

mine why didnt work ?

<%= post.body, :style => “class=‘body_text’” %>

<%= post.body, :class=> “body_text” %>

On Aug 10, 11:40 am, Philip G. <rails-mailing-l…@andreas-

John Y. wrote:

<%= post.body, :class=> “body_text” %>

On Aug 10, 11:40�am, Philip G. <rails-mailing-l…@andreas-

I have been tried this but dint work :confused:

error: SyntaxError in Posts#show

compile error
/Users/webstic/Sites/weblog2/app/views/posts/post.html.erb:6: syntax
error, unexpected tASSOC, expecting tCOLON2 or ‘[’ or ‘.’
…r.concat(( post.body, :class=> “body_text” ).to_s); @output

^

Philip G. wrote:

John Y. wrote:

<%= post.body, :class=> “body_text” %>

On Aug 10, 11:40�am, Philip G. <rails-mailing-l…@andreas-

I have been tried this but dint work :confused:

error: SyntaxError in Posts#show

Remove the comma.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

On Jun 23, 7:10 am, Newb N. [email protected]
wrote:

Hi…
i used paulca-phone_codes plugin for country code.and it works.
<%= f.select :country_code, PhoneCode.options_for_select(:prefix)%>
what i want to know is how to apply css class for this.when i tried like
below it doesnot work
<%= f.select :country_code, PhoneCode.options_for_select(:prefix),
{:class => “mystyle” }%>

Because select takes two hashes of options. The first is for options
for select itself, the second is for html options. You’re sticking
your html options in the first hash.

Fred

Marnen Laibow-Koser wrote:

Philip G. wrote:

John Y. wrote:

<%= post.body, :class=> “body_text” %>

On Aug 10, 11:40�am, Philip G. <rails-mailing-l…@andreas-

I have been tried this but dint work :confused:

error: SyntaxError in Posts#show

Remove the comma.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

when i remove the comma im getting this:

ArgumentError in Posts#show

Showing app/views/posts/_post.html.erb where line #6 raised:

wrong number of arguments (1 for 0)

6: <%= post.body :class => “body_text” %>

Philip G. wrote:

Marnen Laibow-Koser wrote:

Philip G. wrote:

John Y. wrote:

<%= post.body, :class=> “body_text” %>

On Aug 10, 11:40�am, Philip G. <rails-mailing-l…@andreas-

I have been tried this but dint work :confused:

error: SyntaxError in Posts#show

Remove the comma.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

when i remove the comma im getting this:

Yeah, sorry, that was a mistake on my part. You will probably have to
wrap post.body in a div or span to specify the appropriate class.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

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