[Rails] Re: require 'dl' doesn't work

2014-07-14 Thread Joel Pearson
That's a very short error message. What did the rest of the error say? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an

[Rails] Re: Connect automatically on wifi

2013-12-12 Thread Joel Pearson
Since this is in the Rails forum I'll assume you're talking about a website using JavaScript. The short answer is No. JavaScript is sandboxed to avoid giving viruses precisely the kind of control you're asking about. Altering a user's network settings via a website would be a very dangerous

[Rails] Re: Tutorial - Creating a simple ToDo application

2013-12-09 Thread Joel Pearson
The link has an extra on the end. Remove that and it works :) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to

[Rails] Re: ruby script if statement

2013-12-05 Thread Joel Pearson
Rather than asking for small pieces of information one at a time on a forum, you would be much better served by completing a few Rails tutorials and creating some Rails projects on your own computer. Then you will understand what's happening on the server. -- Posted via

[Rails] Re: Hello, someone used to an online spree.

2013-11-20 Thread Joel Pearson
I think Spree should work fine as long as you pay attention to the requirements; such as Ruby version and Rails version. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this

[Rails] Re: avoiding duplicate string writing

2013-11-14 Thread Joel Pearson
You shouldn't need a Regex for that, how about String#include? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to

[Rails] Re: How Rails component works with each other in background?

2013-10-28 Thread Joel Pearson
I suspect that a full answer to that question would necessitate the writing of several books. I don't fully understand what's going on in the background but I'll have a go at explaining my take on it. The Ruby interpreter creates a runtime environment in which to hold the objects. Since Rails

[Rails] Re: How Rails component works with each other in background?

2013-10-28 Thread Joel Pearson
Prasad Gurjar wrote in post #1125841: For e.g How objects are called from controller to view ? what actions are performed in background? The controller is given a template, either implicitly by the method name or explicitly in the code. The template may have multiple extensions, e.g.

[Rails] Re: String interpolation

2013-10-23 Thread Joel Pearson
I'm not sure what the standard is, but I expect you'd handle the conditional when entering the value into the hash. hash = {} hash[:reward] = condition ? Bark five times : Bark four times %{reward} % hash -- Posted via http://www.ruby-forum.com/. -- You received this message because you are

[Rails] Re: What it exactly do these do ( RubyXL::Parser.parse and Roo::Excelx.new) when opening a file?

2013-10-21 Thread Joel Pearson
Usually the simplest way to learn how a gem works internally is to go and read the source code. This should be available in the gem files, on a github repository, or in the documentation. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the

[Rails] Re: What it exactly do these do ( RubyXL::Parser.parse and Roo::Excelx.new) when opening a file?

2013-10-21 Thread Joel Pearson
I haven't examined Roo, but you can see RubyXL reading the file into memory here: https://github.com/gilt/rubyXL/blob/master/lib/rubyXL/parser.rb -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group.

[Rails] Re: What license do you use for your Ruby gems?

2013-10-12 Thread Joel Pearson
I use the MIT license as well. It's common enough that users will recognise it immediately, and covers the basics while being succinct. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To

[Rails] Re: string functions

2013-10-09 Thread Joel Pearson
The String class has methods associated with it. You use these the same way as most methods in Ruby: s = 'a string' s.upcase #= A STRING s.reverse #= GNIRTS A -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on

[Rails] Re: is there any way to convert .xlsx to .xls

2013-10-04 Thread Joel Pearson
I've never personally used it, but allegedly http://rubygems.org/gems/axlsx should work. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails

[Rails] Re: is there any way to convert .xlsx to .xls

2013-10-04 Thread Joel Pearson
Joel Pearson wrote in post #1123519: I've never personally used it, but allegedly http://rubygems.org/gems/axlsx should work. My mistake, that only outputs xlsx. Roo seems to be the obvious choice. -- Posted via http://www.ruby-forum.com/. -- You received this message because you

[Rails] Re: is there any way to convert .xlsx to .xls

2013-10-04 Thread Joel Pearson
Yes, that's how editing files usually works. You overwrite a modified copy of the file. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails

[Rails] Re: Looking for best tutorial for someone brand- new to this type of programming

2013-09-17 Thread Joel Pearson
If you're coming from VBA you'll probably need to brush up on your Object Oriented Programming as well. http://www.tutorialspoint.com/ruby/ruby_object_oriented.htm -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on

[Rails] Re: Need suggestion how can I skip the rest par inside a loop when erro is raised

2013-09-12 Thread Joel Pearson
Just use error handling properly. begin #standard code rescue #only runs if an error occurred else #only runs if an error did not occur ensure #always runs at the end regardless of error level end -- Posted via http://www.ruby-forum.com/. -- You received this message because you are

[Rails] Re: Need suggestion how can I skip the rest par inside a loop when erro is raised

2013-09-12 Thread Joel Pearson
Maybe a real example would help, rather than infinite-loop pseudo-code. val = -3 until val 2 begin val +=1 1/val rescue puts 'Error on ' + val.to_s else puts 'No Error on ' + val.to_s end puts 'Finished with ' + val.to_s end -- Posted via http://www.ruby-forum.com/.

[Rails] Re: Mandrill mail problem

2013-09-11 Thread Joel Pearson
What are you using as the sender (from) address? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to

[Rails] Re: Delete duplicate records from a 2 dimensional array in rails

2013-09-09 Thread Joel Pearson
uniq can take a block as well if you wanted to unique similar arrays on a specific element: @mem.uniq { |mem| mem[1] } Or even on multiple criteria: @mem.uniq { |mem| [ mem[1], mem[2] ] } -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to

[Rails] Re: Requesting information from user

2013-09-05 Thread Joel Pearson
I believe the standard way to do this would be to show a previously hidden div containing a form. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop

[Rails] Re: Fetching links to my rails app

2013-09-04 Thread Joel Pearson
Do you mean you want to link to other sites, or you want to download and display pages / partials from other sites inside your app? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe

[Rails] Re: Issue with mering ActiveRecord query results

2013-08-08 Thread Joel Pearson
If you were going to use Hash#merge to remove duplicates between the two result sets, you might as well just use Array#uniq on the Array. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To

[Rails] Re: store multiple checkbox values in single column of table

2013-08-05 Thread Joel Pearson
If you want to store multiple on/off switches together, then Binary is your friend. No, Yes, No, No, Yes, Yes, No 0100110 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from

[Rails] Re: Laying out the flow of an application - where to start?

2013-07-19 Thread Joel Pearson
I think when you say static html for the pages, you really want dynamically generated content. You need a simple template which presents the requested information with links up and down the chain. The first thing you need to do, particularly if you have data to start off with, is sort out the

[Rails] Re: Learning About Symbols

2013-07-12 Thread Joel Pearson
One reason to use Symbols is that they are immutable. When you're passing one around as an argument or Hash key, it won't change. Another is that multiple instances of a Symbol are the same object, making a smaller memory footprint than Strings. A string is not a symbol. Some structures will

[Rails] Re: Rails Wiki solution on Windows?

2013-07-10 Thread Joel Pearson
Thanks all. MediaWiki is the one I'm planning to use at the moment. Looks like it's time to learn how Apache PHP work :) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this

[Rails] Rails Wiki solution on Windows?

2013-07-09 Thread Joel Pearson
I've been asked to put together a simple intranet Wiki, but the only server I have available is a Windows 7 machine with Rails ( on Ruby 2.0 ) installed. I've been looking around for options which will work on this platform - I tried Instiki and Refinery CMS but neither of them appear to be

[Rails] Re: ajax form submission

2013-07-09 Thread Joel Pearson
This should help: http://edgeguides.rubyonrails.org/working_with_javascript_in_rails.html -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails

[Rails] Re: Rails Wiki solution on Windows?

2013-07-09 Thread Joel Pearson
Useful link, thanks. I was hoping for a Rails option because I haven't yet found another web host which will work on a Windows 7 PC without a fuss. I've tried Wordpress and Joomla, but Microsoft's WebMatrix refuses to work without an actual Internet server, and I only want a local Intranet

[Rails] Re: How can I determine which server is used

2013-07-05 Thread Joel Pearson
I suppose you could check the environment from within the relevant function. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it,

[Rails] Re: Color sequence on Rails console in Windows

2013-07-01 Thread Joel Pearson
I've installed conemu, it looks useful. How do you get Rails to output colour characters to the console? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop

[Rails] Re: Color sequence on Rails console in Windows

2013-07-01 Thread Joel Pearson
Aha, found it. I added Pry to the gemfile, replaced IRB with Pry in the config, and created a .pryrc file with a command to turn the colours on. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group.

[Rails] Re: “Add 'gem sqlite3'' to your Gemfile”

2013-07-01 Thread Joel Pearson
No problem, we're here to help :) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to

[Rails] Re: “Add 'gem sqlite3'' to your Gemfile”

2013-06-30 Thread Joel Pearson
There's a quick guide on how to install Sqlite3 on Windows 7 here: http://www.ruby-forum.com/topic/4413168 I followed the instructions on there, and after a few minor tweaks, I managed to get it working. I've tried to attach a zip with the necessary files in. Hopefully if you can download

[Rails] Re: Correct use of before_validation

2013-06-26 Thread Joel Pearson
Thanks for the tip! If the call to super triggers the validation then that should be perfect. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving

[Rails] Correct use of before_validation

2013-06-25 Thread Joel Pearson
I'm using Rails 3.2.13 with Ruby 2.0.0 I have a field in a form called hours which normally passes a numerical value. However, my users also want the option to pass time values, like 01:15, 00:25, :05, etc. I've tried to allow for this sort of thing with the below code: __ validates

[Rails] Re: Correct use of before_validation

2013-06-25 Thread Joel Pearson
I've managed to get the event to fire now, but what I get from STDOUT is 0.0 So I guess that means I'm not receiving a string from input. before_validation :convert_hours protected def convert_hours STDOUT hours if hours hours =~ /:/ hrs, mins = hours.scan(

[Rails] Re: Correct use of before_validation

2013-06-25 Thread Joel Pearson
Catching that 0.0 value was the right direction to look in: def convert_hours if hours_before_type_cast hours_before_type_cast =~ /:/ hrs, mins = hours_before_type_cast.scan( /(\d*):(\d*)/ ).first self.hours = BigDecimal( ( hrs.to_f + ( mins.to_f / 60.0 ) ), 4 ) end end

[Rails] Re: uninstall dependencies along with the gem

2013-06-22 Thread Joel Pearson
I can see it being quite dangerous to uninstall all dependancies of a given gem. In theory it could be dependant on gems which have become part of the core library in more recent Ruby versions, for example. However if you mean you want to keep only the latest version of each gem, there's the

[Rails] Re: IRB help

2013-06-21 Thread Joel Pearson
You can also execute system commands from within irb using system system( mkdir lesson2 ) or backticks `mkdir lesson2` Although in the case of mkdir you'll probably want to use Dir.pwd to check you're in the right directory, and Dir.chdir('c:/myfolder') to move to the correct folder first. --