[Rails] Re: no such file to load -- my_extensions (MissingSourceFile)

2013-12-22 Thread Toby Rodwell
Many thanks to you both - indeed, I was being a muppet, and it's exactly 
as you suspected, namely I'd forgotten to copy across a file.  Grep'ing 
for the file name helped me track it down.  Thanks again and Merry 
Christmas!

-- 
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 rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/8357a01acf4360b7bb953a7c04310609%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] no such file to load -- my_extensions (MissingSourceFile)

2013-12-20 Thread Toby Rodwell
I have a Rails application runnng on one machien quite happily, using
Ruby 1.9.1-p243 and Rails 2.3.3.  I copied the app and config folders to
another machine, on which I'm also running 1.9.1-p243, but via RVM.
Whenever I try to launch the Rails application ('server', 'runner',
'console') I get the error message  no such file to load --
my_extensions (MissingSourceFile).

Based on one googled suggestion I created a nearly empty file,
$ROOT/config/initializers/my_extensions.rb
but this did not help.  I'm also wondering if I need to create a
'wrapper' as I've seen this mentioned int he contect of using Rails and
RVM - but I can't see what I would need to do for, say, 'ruuner'.  All
advice gratefully received.

-- 
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 rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/d1108543437cd737243921f87b093546%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Passing arrays between controllers/views

2011-09-09 Thread Toby Rodwell
I have a controller that produces (through its associated 'view'
displays summary information of) a number of arrays.  On that view page
I would like links to other pages, one per array, which shows more
detailed information on the array in question.  I tried passing the
array as a parameter to a link and whilst I think that would have been
fine for small arrays for a large array I was getting URI too large.
Since I don't have admin rights to the web server I don't think I can
tweak the http buffer settings, and anyway I don't think very long URLs
are elegant.  What other ways are there to achieve what I am after?  One
suggstion I saw was using a session - is that the best way (the Ruby
way) to pass data between controllers?  Any suggstions gratefully
received.

-- 
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Recursive self-referential many-to-many relationship

2010-06-17 Thread Toby Rodwell
Marnen Laibow-Koser wrote:

 You want awesome_nested_set, which will let you do that with one query. 
 The Glue model is unnecessary.

Thanks very much for the info. I've had a quick look at the 
documentation and I see it makes use of fields :lft and :rgt  -I guess I 
can use aliases for these, along the lines of :lft = my_field, as I 
don't have control of the database?  Also, do you know if 
awesome_nested_set will be faster than what I'm doing currently, or just 
more convenient?

regards
-- 
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 post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Recursive self-referential many-to-many relationship

2010-06-17 Thread Toby Rodwell
Marnen Laibow-Koser wrote:
 Toby Rodwell wrote:
 Marnen Laibow-Koser wrote:

 You may be able to use aliases, but how does this solve the basic 
 problem of adding fields to the DB?
I don't add fields (or even records) to this database - I just use RoR 
as way a way to get data out in a useful format.  Anyway, thanks for the 
pointer to 'awesome'.

-- 
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 post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Recursive self-referential many-to-many relationship

2010-06-16 Thread Toby Rodwell
I have a 'Circuit' table, and a 'Glue' table to perform a many-to-many
join on the circuit records, such at a circuit can have many subcircuits
(its component parts) and many supercircuits (circuits which it itself
is a part of).

  has_and_belongs_to_many :subcircuits,
:class_name = Circuit,
:join_table = circuit_glue,
:association_foreign_key = PTR_component,
:foreign_key = PTR_circuit
  has_and_belongs_to_many :supercircuits,
:class_name = Circuit,
:join_table = circuit_glue,
:foreign_key = PTR_component,
:association_foreign_key = PTR_circuit

With this, I can do successfully things like
my_circuit.subcircuits[0].name
but if I try
my_circuit.subcircuits[0].subcircuits.any_method
... I get a NoMethodError: You have a nil object when you didn't expect
it!
The objects in the cct.subciruits array do not appear to 'full' circuit
objects in as much as they do not repsonsd to 'subcircuits'
To build a recursive list of subcircuits I find I have to resort to

self.subcircuits.each { |sc|
subcirc_array.push(Circuit.find(:all).detect { |c| c.absid.to_s ==
sc.PTR_component })}
... which seems pretty slow and laborious.  Any advice on how to speed
this up, and/or get ...subciruits[n].subcircuits to work as required?
Thanks in advance.
-- 
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 post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Extending a module in a controller

2010-05-23 Thread Toby Rodwell
Frederick Cheung wrote:
 On May 23, 12:59�am, Marnen Laibow-Koser li...@ruby-forum.com wrote:
 ... by putting it inside the controller like that you've
 created a new module called LookupController::Enumerable rather than
 extending Enumerable. If I were you I'd keep extensions to core
 classes somewhere in lib.
 
 Fred

Ah I see, of course.  So I've moved it to 'my_extensions.rb' in lib/, 
added require 'my_extensions' in the controller and now it works fine. 
Thanks!
-- 
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 post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Extending a module in a controller

2010-05-22 Thread Toby Rodwell
I'm trying to extend Enumerable in my Rails app.  I've started with just
the controller where I wanted to use this method i.e.

class LookupController  ApplicationController

module Enumerable
  def my_compress
   

... but when I visit the web page in question I get No method
'my_compress' for Array ...

I'm probably doing something fundamentally wrong - what could/should I
be doing?

thanks
-- 
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 post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Working round 'invalid byte sequence'

2009-11-03 Thread Toby Rodwell

Matt Jones wrote:
 On Nov 2, 5:31�pm, Toby Rodwell rails-mailing-l...@andreas-s.net
 wrote:
 this issue? �Without being an expert in this area (obviously) I guess
 that either I can try to tell Ruby to treat the MySQL data as an
 encoding other than UTF-8 (I guess US-ASCII �but it could be trial and
 error to work out what), and/or I could add some rescue code to find
 (and ignore) bad byte sequences. �I've tried to find recipes for both
 the above, but quickly get lost in the subtleties of it all! �Any and
 all help appreciated. �Many thanks in advance.
 
 I'd check with the whoever admins the MySQL DB to find out what
 character set it's actually using. I think you can then tell the
 adapter to translate. Best guess is either US ASCII, or (more likely)
 Windows-1252 pretending to be ASCII.
 
 --Matt Jones

Many thanks for the reply Matt.  I used the console to determine that 
the db is serving up ASCII-8BIT

e = Equipment.find(:first, :conditions = ['id = ?', 1234])
 e.name.encoding
= #Encoding:ASCII-8BIT

I then set the encoding in /config/database.yml to 'ascii' which 
although it can't display special characters, at least it shows the page 
with ? in place of the accented charaters.  I tried setting encoding 
to ascii-8bit and varieties of this, but each time Rails complained - 
so if anyone can tell me how to indicate ASCII-8BIT I'd be grateful.

-- 
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 post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Working round 'invalid byte sequence'

2009-11-02 Thread Toby Rodwell

I am a very amateur Rubyist who, amongst other things, likes to use a
simple Rails app to query my company's MySQL config database.  The
server I now use to do this has got 1.9.1 and Rails 2.3.3.  I've now hit
the 'problems' related to 1.9 and string encoding, which means that when
Rails try to display, say, E acute characters, it throws an invalid byte
sequence, namely
ArgumentError (invalid byte sequence in UTF-8):

Given that I only access the MySQL database over a private network and
with a read-only account, is there some simple and easy way to suppress
this issue?  Without being an expert in this area (obviously) I guess
that either I can try to tell Ruby to treat the MySQL data as an
encoding other than UTF-8 (I guess US-ASCII  but it could be trial and
error to work out what), and/or I could add some rescue code to find
(and ignore) bad byte sequences.  I've tried to find recipes for both
the above, but quickly get lost in the subtleties of it all!  Any and
all help appreciated.  Many thanks in advance.
-- 
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 post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---