pheonix7284: (Default)

So now that I got the ruby console working, when you get output it’s just a big stream of text, and very hard to read separate results, and just a plain PITA.

This: http://github.com/cldwalker/hirb#readme

Does some excellent formating, comes with the default view enabled, but if you want to make your own configurations you can.
<input ... >

Originally published at thisOrange.com. You can comment here or there.

pheonix7284: (Default)

So now that I got the ruby console working, when you get output it’s just a big stream of text, and very hard to read separate results, and just a plain PITA.

This: http://github.com/cldwalker/hirb#readme

Does some excellent formating, comes with the default view enabled, but if you want to make your own configurations you can.
<input ... >

Originally published at thisOrange.com. You can comment here or there.

pheonix7284: (Default)

I was getting this:

Loading development environment (Rails 2.3.2)
/usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require’: no such file to load — readline (LoadError)
from /usr/local/lib/ruby/1.8/irb/completion.rb:10
from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `require’
from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules’
from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `each’
from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules’
from /usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup’
from /usr/local/lib/ruby/1.8/irb.rb:54:in `start’
from /usr/local/bin/irb:13

Whenever I tried to use the console.  Some helpfull google searching got me this:
http://dirk.net/2009/04/05/no-such-file-to-load-readline-loaderror-when-running-scriptconsole/

Which worked wonders.

I  also caught that I pretty much stick everything I’ve added to my work comp in my home directory.  I have no time for basic organization apparently.
<input ... >

Originally published at thisOrange.com. You can comment here or there.

pheonix7284: (Default)

I was getting this:

Loading development environment (Rails 2.3.2)
/usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require’: no such file to load — readline (LoadError)
from /usr/local/lib/ruby/1.8/irb/completion.rb:10
from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `require’
from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules’
from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `each’
from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules’
from /usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup’
from /usr/local/lib/ruby/1.8/irb.rb:54:in `start’
from /usr/local/bin/irb:13

Whenever I tried to use the console.  Some helpfull google searching got me this:
http://dirk.net/2009/04/05/no-such-file-to-load-readline-loaderror-when-running-scriptconsole/

Which worked wonders.

I  also caught that I pretty much stick everything I’ve added to my work comp in my home directory.  I have no time for basic organization apparently.
<input ... >

Originally published at thisOrange.com. You can comment here or there.

pheonix7284: (Default)

I have several data models that don’t directly know about each other, but need to be connected somehow so results of the opposite type can be returned when searching against the first. But which method to use?

Lets see:

has_and_belongs_to_many

  • make a reference table of only foreign keys – no other attributes(? used to but deprecated)
  • no extra models – Just link to the opposite class from the both models.
  • connected via a table
  • can only join two models

has_many :through

  • make a table with your two ids, and other attributes (editable?)
  • make a (join?) model for that table, that lets it know it belongs to the two models you are linking
  • tell each model that it is linked to it’s opposite model :through=>  the joined model.
  • connected via a model
  • can spiderweb multiple models together

Either will work for most things.  has_many :through seems to be more versatile (if a little more work required to get back what you want), especially if you want extra attributes.  habtm is quick, and simple, but not quite as diverse in it’s functionality.

Now looking closer at what I need to do, I will probably be required to connect at least three things together – and who knows, maybe more! Which would make has_many :through the way to go.

Good articles for more information or examples:

http://blog.hasmanythrough.com/2006/4/20/many-to-many-dance-off

http://stevengharms.com/rails-stevens-guide-to-many-to-many-associations-or-habtm-12
<input ... >

Originally published at thisOrange.com. You can comment here or there.

pheonix7284: (Default)

I have several data models that don’t directly know about each other, but need to be connected somehow so results of the opposite type can be returned when searching against the first. But which method to use?

Lets see:

has_and_belongs_to_many

  • make a reference table of only foreign keys – no other attributes(? used to but deprecated)
  • no extra models – Just link to the opposite class from the both models.
  • connected via a table
  • can only join two models

has_many :through

  • make a table with your two ids, and other attributes (editable?)
  • make a (join?) model for that table, that lets it know it belongs to the two models you are linking
  • tell each model that it is linked to it’s opposite model :through=>  the joined model.
  • connected via a model
  • can spiderweb multiple models together

Either will work for most things.  has_many :through seems to be more versatile (if a little more work required to get back what you want), especially if you want extra attributes.  habtm is quick, and simple, but not quite as diverse in it’s functionality.

Now looking closer at what I need to do, I will probably be required to connect at least three things together – and who knows, maybe more! Which would make has_many :through the way to go.

Good articles for more information or examples:

http://blog.hasmanythrough.com/2006/4/20/many-to-many-dance-off

http://stevengharms.com/rails-stevens-guide-to-many-to-many-associations-or-habtm-12
<input ... >

Originally published at thisOrange.com. You can comment here or there.

Profile

pheonix7284: (Default)
pheonix7284

March 2014

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829
3031     

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags