Re: [Rails] How would you upgrade

2013-06-01 Thread Walter Lee Davis
On Jun 1, 2013, at 11:23 AM, Warren Prince wrote: > We have a very large application with probably close to 100K lines of > code, maybe more. We're still running at 2.3.11, but upgraded to ruby > 1.9.3. We were trying to step through an upgrade to 3.0 and every time > we make a little progress

Re: [Rails] How about add a method to truncate a long text more smart?

2013-06-01 Thread Tamara Temple
soffolk Zhu wrote: > sometimes we need to truncate a long text more smart. > > The Model layer represents your domain model (such as Account, Product, > Person, Post, etc.) and encapsulates > the business logic that is specific to your application. In Rails, > database-backed model cla

[Rails] Re: Re: Re: Re: Re: Re: Nokogiri#css("input:disabled") not working

2013-06-01 Thread Love U Ruby
Tamara Temple wrote in post #1110947: > [1] https://developer.mozilla.org/en-US/docs/Web/CSS/:disabled > [2] see this ugly thing at > https://dl.dropboxusercontent.com/u/571329/Examples/greenjunk.html See the issue - https://github.com/sparklemotion/nokogiri/issues/907 -- Posted via http://www

Re: [Rails] Re: accidentally created a rails app in the home folder

2013-06-01 Thread Colin Law
On 1 June 2013 18:05, mark ronay wrote: > Alright, now its working kind of! After restarting the computer and > using which rails i get the much more sensible looking path * > /usr/local/bin/rails * > running wc -l `which path` I get * 19 /usr/local/bin/rails * > > so now navigating above my home

Re: [Rails] Re: Re: Re: Re: Re: Nokogiri#css("input:disabled") not working

2013-06-01 Thread Tamara Temple
So here is something I don't quite understand. According to [1], "input:disabled" is a quite valid CSS selector. Given this[2]: input:disabled {background: #0F0; color: #F00;} Why wouldn't doc.css("input:disabled") also work? Clearly it doesn't, but I don't know what it *should* be. (Noti

[Rails] Re: Re: Re: Re: Re: Nokogiri#css("input:disabled") not working

2013-06-01 Thread Love U Ruby
Hassan Schroeder wrote in post #1110937: > On Sat, Jun 1, 2013 at 9:47 AM, Love U Ruby > wrote: > >>> And in this case, what do you think 'eq' is ? >> >> This is a jQuery extension, and usable in Nokogiri. But some of the >> rules are not working. > > Uh, sure. Whatever you want to believe. Good l

Re: [Rails] Re: Re: Re: Re: Nokogiri#css("input:disabled") not working

2013-06-01 Thread Hassan Schroeder
On Sat, Jun 1, 2013 at 9:47 AM, Love U Ruby wrote: >> And in this case, what do you think 'eq' is ? > > This is a jQuery extension, and usable in Nokogiri. But some of the > rules are not working. Uh, sure. Whatever you want to believe. Good luck! -- Hassan Schroeder h

[Rails] Re: accidentally created a rails app in the home folder

2013-06-01 Thread mark ronay
Alright, now its working kind of! After restarting the computer and using which rails i get the much more sensible looking path * /usr/local/bin/rails * running wc -l `which path` I get * 19 /usr/local/bin/rails * so now navigating above my home directory I am able to use rails new like so: * m

[Rails] Re: Need a help to get a good start with Nokogiri #css syntax.

2013-06-01 Thread Love U Ruby
gerry.jenk...@gmail.com wrote in post #1110301: > check out this reference: > > http://www.w3schools.com/cssref/css_selectors.asp here is another link: http://reference.sitepoint.com/css/pseudoclass-firstoftype -- Posted via http://www.ruby-forum.com/. -- You received this message because yo

[Rails] Re: Re: Re: Re: Nokogiri#css("input:disabled") not working

2013-06-01 Thread Love U Ruby
Hassan Schroeder wrote in post #1110932: > On Sat, Jun 1, 2013 at 9:17 AM, Love U Ruby > wrote: > >>> Where in the Nokogiri docs does it say that? Where in the docs is >>> an example of the syntax you are trying to use? >> >> see below: > > Uh, as I said -- in the docs? > >> p doc.css("div p:eq(2)

Re: [Rails] Re: Re: Re: Nokogiri#css("input:disabled") not working

2013-06-01 Thread Hassan Schroeder
On Sat, Jun 1, 2013 at 9:17 AM, Love U Ruby wrote: >> Where in the Nokogiri docs does it say that? Where in the docs is >> an example of the syntax you are trying to use? > > see below: Uh, as I said -- in the docs? > p doc.css("div p:eq(2)") And in this case, what do you think 'eq' is ? --

[Rails] Re: Re: Re: Nokogiri#css("input:disabled") not working

2013-06-01 Thread Love U Ruby
Hassan Schroeder wrote in post #1110928: > Where in the Nokogiri docs does it say that? Where in the docs is > an example of the syntax you are trying to use? see below: require "nokogiri" doc = Nokogiri::HTML::Document.parse(<<-eohtml) div { float:left; } span { color:blue; } div1

Re: [Rails] Re: Re: Nokogiri#css("input:disabled") not working

2013-06-01 Thread Hassan Schroeder
On Sat, Jun 1, 2013 at 8:35 AM, Love U Ruby wrote: > But Nokogiri supports jQuery css rules Where in the Nokogiri docs does it say that? Where in the docs is an example of the syntax you are trying to use? -- Hassan Schroeder hassan.schroe...@gmail.com http://about.me/

[Rails] Re: Re: Nokogiri#css("input:disabled") not working

2013-06-01 Thread Love U Ruby
Hassan Schroeder wrote in post #1110922: > On Sat, Jun 1, 2013 at 8:04 AM, Love U Ruby > wrote: > >>> What makes you think that's valid syntax? > >> Here I have seen. http://api.jquery.com/disabled-selector/ > > Uh, that's nice. But your question is about Nokogiri, not jQuery. But Nokogiri suppor

Re: [Rails] Re: Nokogiri#css("input:disabled") not working

2013-06-01 Thread Hassan Schroeder
On Sat, Jun 1, 2013 at 8:04 AM, Love U Ruby wrote: >> What makes you think that's valid syntax? > Here I have seen. http://api.jquery.com/disabled-selector/ Uh, that's nice. But your question is about Nokogiri, not jQuery. -- Hassan Schroeder hassan.schroe...@gmail.co

[Rails] How would you upgrade

2013-06-01 Thread Warren Prince
We have a very large application with probably close to 100K lines of code, maybe more. We're still running at 2.3.11, but upgraded to ruby 1.9.3. We were trying to step through an upgrade to 3.0 and every time we make a little progress it seems Rails or Ruby has released a new version, and I can

[Rails] Re: Nokogiri#css("input:disabled") not working

2013-06-01 Thread Love U Ruby
Hassan Schroeder wrote in post #1110918: > On Sat, Jun 1, 2013 at 12:33 AM, Love U Ruby > wrote: > >> p doc.css("input:disabled").count > >> Why the errors are throwing up? > > What makes you think that's valid syntax? > > -- > Hassan Schroeder hassan.schroe...@gmail.com >

Re: [Rails] Nokogiri#css("input:disabled") not working

2013-06-01 Thread Hassan Schroeder
On Sat, Jun 1, 2013 at 12:33 AM, Love U Ruby wrote: > p doc.css("input:disabled").count > Why the errors are throwing up? What makes you think that's valid syntax? -- Hassan Schroeder hassan.schroe...@gmail.com http://about.me/hassanschroeder twitter: @hassan -- You

[Rails] Re: Re: Re: Re: A simple javascript alert not working

2013-06-01 Thread Paul Bergstrom
Norbert Melzer wrote in post #1110905: > 2013/6/1 Paul Bergstrom > I mean, if your js-file is /app/views/test/index.js.erb AND your > controller > is /app/controllers/test_controller.rb AND you have route setup to the > index action, then you have to point your browser to " > http://localhost:300

Re: [Rails] Re: Re: Re: A simple javascript alert not working

2013-06-01 Thread Norbert Melzer
2013/6/1 Paul Bergstrom > Norbert Melzer wrote in post #1110888: > > Oh, and when you want to have a js response, then you must use > > /test/index.js, without the extension given rails will try to deliver > > HTML > > I know. You mean index.js.erb? I mean, if your js-file is /app/views/test/in

[Rails] Re: accidentally created a rails app in the home folder

2013-06-01 Thread Rick
i now see i misstyped the instructions to step 2. here it is, corrected 2) type the command "wc -l `which rails`" -- if you can't figure out the quoting just use the result of step 1. i.e. on my system "wc -l /opt/local/bin/rails" the idea is to use the wc command to get the number of lined i

Re: [Rails] Re: Re: Re: A simple javascript alert not working

2013-06-01 Thread Colin Law
On 1 June 2013 11:52, Paul Bergstrom wrote: > Colin Law wrote in post #1110893: >> On 1 June 2013 10:52, Paul Bergstrom wrote: in the browser to see what is being sent to the browser. Colin >>> >>> Doesn't seem to load. This should be so incredible simple. Why doesn't >>> it work?

[Rails] Re: Re: Re: A simple javascript alert not working

2013-06-01 Thread Paul Bergstrom
Colin Law wrote in post #1110893: > On 1 June 2013 10:52, Paul Bergstrom wrote: >>> in the browser to see what is being sent to the browser. >>> >>> Colin >> >> Doesn't seem to load. This should be so incredible simple. Why doesn't >> it work? What have I missed? > > No idea what you mean by "does

[Rails] Re: Re: Re: A simple javascript alert not working

2013-06-01 Thread Paul Bergstrom
Norbert Melzer wrote in post #1110888: > Have you a route to a corresponding controller in general? Have you a > controller? Does this controller work when you try to deliver an HTML > view? Yes. > Oh, and when you want to have a js response, then you must use > /test/index.js, without the extens

Re: [Rails] Re: Re: A simple javascript alert not working

2013-06-01 Thread Colin Law
On 1 June 2013 10:52, Paul Bergstrom wrote: > Colin Law wrote in post #1110879: >> On 1 June 2013 09:00, Paul Bergstrom wrote: >>> >>> Not sure how I can explain it better. It's a very simple example. >>> >>> When going with the browser to an action with a corresponding *.js.erb >>> file should t

[Rails] possible to pass two view id's to controller?

2013-06-01 Thread Vitalis
I have has_many through for User, Prog and Enrollment models. Idea is that User is able to add Prog to his profile and Prog is able to remove association from Enrollment or update status attribute. def create @prog = Prog.find(params[:id]) Enrollment.create(user_id: current_user.id, p

[Rails] How about add a method to truncate a long text more smart?

2013-06-01 Thread soffolk Zhu
sometimes we need to truncate a long text more smart. eg: The Model layer represents your domain model (such as Account, Product, Person, Post, etc.) and encapsulates the business logic that is specific to your application. In Rails, database-backed model classes are derived from ActiveRecor

Re: [Rails] Re: Re: A simple javascript alert not working

2013-06-01 Thread Norbert Melzer
Have you a route to a corresponding controller in general? Have you a controller? Does this controller work when you try to deliver an HTML view? Oh, and when you want to have a js response, then you must use /test/index.js, without the extension given rails will try to deliver HTML (if you haven't

[Rails] Re: Re: A simple javascript alert not working

2013-06-01 Thread Paul Bergstrom
Colin Law wrote in post #1110879: > On 1 June 2013 09:00, Paul Bergstrom wrote: >> >> Not sure how I can explain it better. It's a very simple example. >> >> When going with the browser to an action with a corresponding *.js.erb >> file should the JavaScript in that file run, like alert("hello")?

Re: [Rails] Re: A simple javascript alert not working

2013-06-01 Thread Colin Law
On 1 June 2013 09:00, Paul Bergstrom wrote: > Colin Law wrote in post #1110840: >> On 31 May 2013 18:36, Paul Bergstrom wrote: >>> If I have a file in view /test called index.js.erb and in it a simple >>> alert("hello") shouldn't that run when I go to /test/index? It doesn't. >> >> I think you wi

[Rails] Re: A simple javascript alert not working

2013-06-01 Thread Paul Bergstrom
Colin Law wrote in post #1110840: > On 31 May 2013 18:36, Paul Bergstrom wrote: >> If I have a file in view /test called index.js.erb and in it a simple >> alert("hello") shouldn't that run when I go to /test/index? It doesn't. > > I think you will have to give us a bit more detail on exactly what

Re: [Rails] accidentally created a rails app in the home folder

2013-06-01 Thread Colin Law
On 31 May 2013 23:28, mark ronay wrote: > Im a new user - I just installed rails, following directions here: > http://rubyonrails.org/download > however, when it came time to make a rails new path/etc/etc I get this > message: > Can't initialize a new Rails application within the directory of > an

[Rails] Nokogiri#css("input:disabled") not working

2013-06-01 Thread Love U Ruby
doc = Nokogiri::HTML::Document.parse(<<-eohtml) http://code.jquery.com/jquery-1.9.1.js";> eohtml p doc.css("input:disabled").count # >> 2 # ~> /home/kirti/.rvm/gems/ruby-2.0.0-p0/gems/nokogiri-1.5.9/lib/nokogiri/xml/node.rb:159:in `evaluate': xmlXPathCompOpEval: function disabled no