[Rails] multiple "view" directories to achieve rails "themes"

2010-04-23 Thread rails.n...@gmail.com
Hi

I'd like to have various "themes" for my site that cannot be achieved
by changing the CSS or anything else.

So my directory structure might look like this:

 app
   \ views
-
  \ users
  \ blogs
-
  \ THEME2
   -
\ users
\ blogs

(where the two "users" directories contain all the erb or haml)

With my controllers - is there a way to conditionally insert the
"theme2" directory into the view path before the erb/haml gets
searched for and rendered ?

Would be nice to no have to explicitly call render

I'm using rails3

Any ideas?

thanks!






-- 
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] help me pls:Tracking mails in rails

2010-04-23 Thread Tony Augustine
hai friends  can  anone  help me to provide a way to implement the
following  using  rails.

 i  created a  mail campaign  application.if a   user   successfuly
created a campaign he  will be  getting a mail.

1. how i can  track that someone opens the mail?
what i did is  just pass some  parameters like used id  , campaign id
along  with this.then i created  one  table   to store the  resulting
url, campaign id, user id, and   count. can  anyone tell me about he
controller method . is ma  way is  correct or  not?


2.  if  one  user  got a  mail and   he forward  that mail, how  can i
track ordetect the  forward mail count.


Thanks,

tony
-- 
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] List time zones?

2010-04-23 Thread Morgan Morgan
Is there a way to list the time zones that rails makes available (it
seems to function only on cities)?

I figured out how to get that list at the command line in rake but i
can't seem to get access to the list of available ones from within a
rails 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 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.



Re: [Rails] Using AWS RDS with Rails

2010-04-23 Thread Bill Walton
Hi Yudi,

On Fri, Apr 23, 2010 at 6:48 PM, Yudi Soesanto  wrote:

> Thanks for your reply Bill.
>
> I don't have RDS instance set up yet. I am blank about RDS stuff.
> Maybe, you could help me? Any documentation how to setup RDS instance?
>
> The best recommendation I can give is to download the Amazon docs and use
their tutorial.  The tools are not hard to use in terms of setting up an
instance, but IMHO it sucks that they don't have a console interface yet.
Still, rds is a good offering and you can connect to it with your local gui
front end, I'm told.  Frankly, I haven't been able to get that working yet
but it's probably just a time-availability problem on my part.

Best regards,
Bill

--
> *From: * Bill Walton 
> *Date: *Fri, 23 Apr 2010 18:34:59 -0500
> *To: *
> *Subject: *Re: [Rails] Using AWS RDS with Rails
>
> Hi Yudi,
>
> On Fri, Apr 23, 2010 at 11:59 AM, Yudi Soesanto wrote:
>
>> Guys,
>>
>> Could you give pointer how I can use AWS RDS with rails?
>>
>> Is there any plugins to accomplish this?
>>
>>
> Assuming you've already got an RDS instance set up, all you need to do is
> modify your database.yml file to point to it.
>
> HTH,
> Bill
>
> --
> 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.
>
> --
> 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.
>

-- 
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: About your application's environment URL not found

2010-04-23 Thread command0
Oh yes, I forgot to tell you how to disable the default site.

>From the shell run "sudo a2dissite default".

Then run your preferred editor, and create a new file in /etc/apache2/
sites-enabled, and name it whatever you want. I usually name it
something similar to the domain name of the app or site.

If you were to use vi, you do something like:

sudo vi /etc/apache2/sites-enabled/project1

I





ESC
:w
:q

And then you'd run "sudo a2ensite project1" (or whatever you named the
file)
And finally run "sudo /etc/init.d/apache2 reload".

And walla! :)

On Apr 23, 6:28 pm, Henry Oss  wrote:
> Hi
>
> I am a newbie (which you probably guessed from the subject) and have
> just installed ruby 1.8.7, rails 2.3.5 and apache 2.2.12 on ubuntu 9.10.
>
> I have created a rails app and edited my apache config as shown below.
> The Rails "Welcome aboard" page displays, but when I click on "About
> your application's environment" I get
>
> "Not Found
>
> The requested URL /public/rails/info/properties was not found on this
> server.
> Apache/2.2.12 (Ubuntu) Server at localhost Port 80"
>
> Can anybody tell me what I have done wrong?
>
> Thanks in advance
>
> -
> Apache config at /etc/apache2/sites-available/default
> 
>   ServerAdmin webmas...@localhost
>
>   DocumentRoot /home/henry/Projects/Project1
>   
>     Options FollowSymLinks
>     AllowOverride None
>   
>   
>     Options Indexes FollowSymLinks MultiViews ExecCGI
>     AllowOverride All
>     Order allow,deny
>     allow from all
>     AddHandler cgi-script .cgi
>   
>
>   ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
>   
>     AllowOverride None
>     Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
>     Order allow,deny
>     Allow from all
>   
>
>   ErrorLog /var/log/apache2/error.log
>
>   # Possible values include: debug, info, notice, warn, error, crit,
>   # alert, emerg.
>   LogLevel warn
>
>   CustomLog /var/log/apache2/access.log combined
>
>     Alias /doc/ "/usr/share/doc/"
>     
>         Options Indexes MultiViews FollowSymLinks
>         AllowOverride None
>         Order deny,allow
>         Deny from all
>         Allow from 127.0.0.0/255.0.0.0 ::1/128
>     
>
> 
> --
> Posted viahttp://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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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: About your application's environment URL not found

2010-04-23 Thread command0
Welcome to Rails. :)

It all seems overwhelming at first, but it is quite easy to learn once
you get your head around how Rails does things in contrast to other
languages.

So a couple thoughts.

It sounds like you are running on a Linux distro. Ubuntu or Debian it
appears from the Apache directory structure.

Assuming that, do yourself a huge favor and install Passenger, and
scrap the CGI, it's not worth the effort making it work. Go to
http://modrails.org/install.html, and that will list out the
installation instructions.

Secondly, in your VirtualHosts file, you need to be pointing to your
public directory of your Rails apps, not the ROOT_DIR so to speak.

So DocumentRoot needs to be like "/home/henry/Projects/Project1/
public".

I have always found it easiest to disable the default site, and make
my own VirtualHost file from scratch.

Here is what one of my VirtualHost files looks like on my Rails web
server:

==


ServerName iloveorganic.co.uk
ServerAlias www.iloveorganic.co.uk

DocumentRoot /var/www/sites/iloveorganic/public
RailsEnv development
PassengerDefaultUser web

==
Hope this helps. :)

Thanks,

Justin

On Apr 23, 6:28 pm, Henry Oss  wrote:
> Hi
>
> I am a newbie (which you probably guessed from the subject) and have
> just installed ruby 1.8.7, rails 2.3.5 and apache 2.2.12 on ubuntu 9.10.
>
> I have created a rails app and edited my apache config as shown below.
> The Rails "Welcome aboard" page displays, but when I click on "About
> your application's environment" I get
>
> "Not Found
>
> The requested URL /public/rails/info/properties was not found on this
> server.
> Apache/2.2.12 (Ubuntu) Server at localhost Port 80"
>
> Can anybody tell me what I have done wrong?
>
> Thanks in advance
>
> -
> Apache config at /etc/apache2/sites-available/default
> 
>   ServerAdmin webmas...@localhost
>
>   DocumentRoot /home/henry/Projects/Project1
>   
>     Options FollowSymLinks
>     AllowOverride None
>   
>   
>     Options Indexes FollowSymLinks MultiViews ExecCGI
>     AllowOverride All
>     Order allow,deny
>     allow from all
>     AddHandler cgi-script .cgi
>   
>
>   ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
>   
>     AllowOverride None
>     Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
>     Order allow,deny
>     Allow from all
>   
>
>   ErrorLog /var/log/apache2/error.log
>
>   # Possible values include: debug, info, notice, warn, error, crit,
>   # alert, emerg.
>   LogLevel warn
>
>   CustomLog /var/log/apache2/access.log combined
>
>     Alias /doc/ "/usr/share/doc/"
>     
>         Options Indexes MultiViews FollowSymLinks
>         AllowOverride None
>         Order deny,allow
>         Deny from all
>         Allow from 127.0.0.0/255.0.0.0 ::1/128
>     
>
> 
> --
> Posted viahttp://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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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: link_to with resource routes in helper file?

2010-04-23 Thread Tim
sorry, my bad  started working on a new app and it was including
some bad juju:)

On Apr 23, 4:04 pm, Tim  wrote:
> sorry  under rspec that is with rails 2.3.5
>
> On Apr 23, 3:26 pm, Tim  wrote:
>
> > Hey all!
>
> > Any pointers on doing something like:
>
> >   link_to "Comments", comments_path
>
> > from within a helper file just like you can do from a view?
>
> > Thanks in advance!
>
> > --
> > 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 
> > athttp://groups.google.com/group/rubyonrails-talk?hl=en.
>
> --
> 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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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] About your application's environment URL not found

2010-04-23 Thread Henry Oss
Hi

I am a newbie (which you probably guessed from the subject) and have
just installed ruby 1.8.7, rails 2.3.5 and apache 2.2.12 on ubuntu 9.10.

I have created a rails app and edited my apache config as shown below.
The Rails "Welcome aboard" page displays, but when I click on "About
your application's environment" I get

"Not Found

The requested URL /public/rails/info/properties was not found on this
server.
Apache/2.2.12 (Ubuntu) Server at localhost Port 80"

Can anybody tell me what I have done wrong?

Thanks in advance

-
Apache config at /etc/apache2/sites-available/default

  ServerAdmin webmas...@localhost

  DocumentRoot /home/henry/Projects/Project1
  
Options FollowSymLinks
AllowOverride None
  
  
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
allow from all
AddHandler cgi-script .cgi
  

  ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
  

  ErrorLog /var/log/apache2/error.log

  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
  LogLevel warn

  CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"

Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128



-- 
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] Rails3 + PostgreSQL

2010-04-23 Thread Greg Donald
Anyone know if Rails 3 supports PostgreSQL yet?  I'm again trying on
the latest beta, still not getting anything to work.

I have every postgresql gem I can find installed:

> gem list --local|grep ^p
pg (0.9.0)
postgres (0.7.9.2008.01.28)
postgres-pr (0.6.3)

My database.yml entry:

development:
  adapter: postgresql
  database: rails3_dev
  username: rails3
  password: rails3

Then when I try it, I get this:

RuntimeError (Please install the postgresql adapter: `gem install
activerecord-postgresql-adapter` (no such file to load -- pg)):

I'm not finding a gem by that name:

> gem install activerecord-postgresql-adapter
ERROR:  could not find gem activerecord-postgresql-adapter locally or
in a repository

This page doesn't even mention that gem:

http://wiki.rubyonrails.org/database-support/postgres

Anyone get this to work yet?


-- 
Greg Donald
destiney.com | gregdonald.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: Best way to handle multiple tables to replace one big ta

2010-04-23 Thread Marnen Laibow-Koser
Mike P. wrote:
> Marnen Laibow-Koser wrote:
>> Mike P. wrote:
>>> Hello,
>>> 
>>> I've decided to use multiple tables for an entity (e.g. "todo_items1,"
>>> "todo_items2," "todo_items3," etc.), instead of just one main table
>>> which could end up having a lot of rows (e.g. just "todo_items"). I'm
>>> doing this to try and to avoid a potential future performance drop that
>>> could come with having too many rows in one table.
>> 
>> Robert already said it, and I agree: DO NOT DO THIS.  Any decent DB 
>> system is designed to handle tables in the millions of rows without 
>> breathing hard.  Just index your tables properly and make sure your 
>> queries are efficient.
>> 
>> If you have to use your DB's sharding features at some point, go for it. 
>> But don't even think of doing this in the app layer.
>> 
>> Best,
>> --
>> Marnen Laibow-Koser
>> http://www.marnen.org
>> mar...@marnen.org
> 
> Hi Marnen,
> 
> Thank you also for your post and advice. It actually made me think more 
> about this. So you're saying that even if I had millions of records in a 
> table, and was noticing a decrease in performance, that I shouldn't 
> split up the tables this way?

Correct, unless there is no better way to improve things (which will 
almost certainly not be the case).

> Would a shard be the only option?

Depends on the DB.

> 


> One of the things that I keep coming back to when I think about the 
> single-table option is that one of the fields will be rather large, like 
> a blog-post in size. And I plan on indexing that to make it searchable. 
> Also, there's a lot of insertions and deletions. Does it still make 
> sense to include all of that in a single table? Or does that change any 
> of your advice?

That does not change any of my advice -- right up until the point where 
you have actual, measurable problems.  And by then, your data model may 
be different anyway.  Don't prematurely optimize, because you may be 
optimzing the wrong things.

> 
> I agree that this is an application layer split, sort of; but I don't 
> think that this particular split is a bad thing.
> 

On what basis do you think that?  (I think you're wrong, but I want to 
know your reasoning.)

> If I did this in pure Ruby, for example, I'm guessing that the effect 
> would be minimal (just one class/method that looks up the correct table, 
> and returns the object for that table). 

But it is still inappropriate, because this can be handled more 
efficiently on the DB side than on the app side.

> What's (potentially) making the 
> app layer bloated is all of the unused 'has_many' attributes since I'm 
> trying to stick with Rails. I really do want to be able to take 
> advantage of the nice Rails methods and functionality... I'm just trying 
> to avoid having a bunch of unused associations for each user object.
> 

Then don't try to use a silly schema like the one you proposed.  Perhaps 
you will ultimately need something like MySQL's MERGE table, but you 
don't need to worry about that yet.

> Is there maybe a way to unload a 'has_many' association for an object? 
> Or perhaps call 'has_many' inside of a user-specific method or 
> something? Like
> 
> if @current_user.todo_table_number == 1
>   has_many :todo_items1
> elsif @current_user.todo_table_number == 2
>   has_many :todo_items2
> elsif ...
> 

Don't bother.

> 
> Anyway, the reason why I'm trying to stay away from the database-layer 
> stuff is because they seem to be a bit 'much' right now, 

Right!  They are a bit much right now -- because they are premature 
optimization.  When you need them, they will be the right tools.

> and also can 
> apparently cause problems. For example, even adding foreign keys at the 
> database-layer can evidently cause issues with testing, and sometimes 
> they get lost in db:push/db:pull calls.

You apparently are passing on FUD you've heard somewhere.  I assure you 
-- from experience -- that this is completely untrue.

> 
> Okay, how about this. Let's say that instead of my original post, I 
> posted saying that I have a large table with 7 million+ rows that keeps 
> growing. I had already split up the tables in the manner mentioned in 
> the original post. Also, let's say that I really wanted to stick with 
> the-Rails-way and was opposed to sharding. What would your advice be 
> then?

I would advise you to get over your anti-sharding bias and do things as 
I outlined above.

> 
> Thanks again for your help,
> Mike

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
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.



Re: [Rails] Using AWS RDS with Rails

2010-04-23 Thread Yudi Soesanto
Thanks for your reply Bill.

I don't have RDS instance set up yet. I am blank about RDS stuff. 
Maybe, you could help me? Any documentation how to setup RDS instance?

Thank You,
Ys




-Original Message-
From: Bill Walton 
Date: Fri, 23 Apr 2010 18:34:59 
To: 
Subject: Re: [Rails] Using AWS RDS with Rails

Hi Yudi,

On Fri, Apr 23, 2010 at 11:59 AM, Yudi Soesanto  wrote:

> Guys,
>
> Could you give pointer how I can use AWS RDS with rails?
>
> Is there any plugins to accomplish this?
>
>
Assuming you've already got an RDS instance set up, all you need to do is
modify your database.yml file to point to it.

HTH,
Bill

-- 
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.


-- 
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: Rails 3 associations extra attributes with lazy loading

2010-04-23 Thread Will Prater
I've fixed my issues.  Should have been using joins vs includes as
there was really no joins happening with eager loading.

On Apr 23, 11:14 am, Will Prater  wrote:
> Hi,
>
> Sure, here is the schema, and model files.  Let me know what you
> think.  Why can't I get the :select to work when using ".includes".
> In the console examples below, you can see the pay_rate and bill_rate
> are not present in the example using .includes.
>
> Schemahttps://gist.github.com/76e70c7f31b6dcc5cfcc
>
> Consultant Modelhttps://gist.github.com/93e5858417bb14ec18c9
>
> Project Modelhttps://gist.github.com/8545e9da49742b4e4dcb
>
> Console output using .includes does not honor :select
> 
> ruby-1.8.7-p249 >
> Project.includes(:consultants).first.to_json(:include => :consultants)
>  => "{\"start_date\":null,\"name\":\"Widget Assembly\",\"created_at\":
> \"2010-04-22T22:52:29Z\",\"updated_at\":\"2010-04-22T22:52:29Z\",
> \"sales_contact_id\":null,\"id\":1,\"enabled\":true,\"client_id\":
> 1,\"consultants\":[{\"created_at\":\"2010-04-22T22:52:29Z\",
> \"updated_at\":\"2010-04-23T02:35:58Z\",\"recruiter_contact_id\":
> 1,\"payclass\":2,\"id\":1,\"enabled\":true,\"phone\":\"\",\"last_name
> \":\"Wright\",\"first_name\":\"Steve\",\"email\":\"st...@palmtest.com
> \"}],\"end_date\":null}"
>
> Console output using does honor :select, but uses N + 1 queries for
> all the consultants in a project
> 
> ruby-1.8.7-p249 > Project.first.to_json(:include => :consultants)
>  => "{\"start_date\":null,\"name\":\"Widget Assembly\",\"created_at\":
> \"2010-04-22T22:52:29Z\",\"updated_at\":\"2010-04-22T22:52:29Z\",
> \"sales_contact_id\":null,\"id\":1,\"enabled\":true,\"client_id\":
> 1,\"consultants\":[{\"start_date\":null,\"pay_rate\":\"40\",
> \"created_at\":\"2010-04-22T22:52:29Z\",\"updated_at\":
> \"2010-04-23T02:35:58Z\",\"recruiter_contact_id\":1,\"project_id\":
> \"1\",\"consultants_projects_id\":\"1\",\"bill_rate\":\"80\",\"payclass
> \":2,\"id\":1,\"enabled\":true,\"consultants_projects_enabled\":\"t\",
> \"phone\":\"\",\"last_name\":\"Wright\",\"end_date\":null,\"first_name
> \":\"Steve\",\"email\":\"st...@palmtest.com\"}],\"end_date\":null}"
>
> Any help is appreciated.  Am I doing something wrong, or is this just
> not supported?
>
> -Will
>
> On Apr 23, 7:17 am, tommy xiao  wrote:
>
>
>
>
>
> > hi,Will
> >     can you use gist to provide more code? it is examine your code.
>
> > 2010/4/23 tommy xiao 
>
> > > interest topic. in console, use to_sql to represent SQL, Maybe found more
> > > hits.
>
> > > 2010/4/23 Will Prater 
>
> > > More observations I've found.  The Arel includes method does not seem
> > >> to respect HMT :select joins.  I'd prefer to use the "includes" lazy-
> > >> laoding way, but cannot seem to get the extra attributes to come back.
>
> > >> Both will return the Manager Model
> > >> 
> > >> ruby-1.8.7-p249 > p = Project.first.managers.first
> > >>  => # > >> email: nil, phone: nil, created_at: "2010-04-22 22:52:29", updated_at:
> > >> "2010-04-22 22:52:29">
>
> > >> ruby-1.8.7-p249 > p = Project.includes(:managers).first.managers.first
> > >>  => # > >> email: nil, phone: nil, created_at: "2010-04-22 22:52:29", updated_at:
> > >> "2010-04-22 22:52:29">
>
> > >> Notice that all the extra attributes are NOT passed
> > >> ===
> > >> ruby-1.8.7-p249 > p =
> > >> Project.includes(:managers).first.managers.first.to_json
> > >>  => "{\"created_at\":\"2010-04-22T22:52:29Z\",\"updated_at\":
> > >> \"2010-04-22T22:52:29Z\",\"id\":1,\"phone\":null,\"last_name\":
> > >> \"Scissorhands\",\"first_name\":\"Edward\",\"email\":null}"
>
> > >> Notice that all the extra attributes are passed
> > >> ===
> > >> ruby-1.8.7-p249 > p = Project.first.managers.first.to_json
> > >>  => "{\"created_at\":\"2010-04-22T22:52:29Z\",\"updated_at\":
> > >> \"2010-04-22T22:52:29Z\",\"project_id\":\"1\",\"primary\":\"t\",
> > >> \"manager_id\":\"1\",\"id\":1,\"phone\":null,\"last_name\":
> > >> \"Scissorhands\",\"first_name\":\"Edward\",\"email\":null}"
>
> > >> Here is the setup in my Model
> > >> ===
> > >> has_many :managers_projects
> > >> has_many :managers, :through => :managers_projects,
> > >>  :select => 'managers.*, managers_projects.project_id,
> > >> managers_projects.manager_id, managers_projects.`primary`'
>
> > >> On Apr 21, 5:00 pm, Will Prater  wrote:
> > >> > Hello,
>
> > >> > How can one get the extra attributes from the association table while
> > >> > using lazy loading like so:
>
> > >> > # I have a HMT (rails3) association and am using the includes method
> > >> > to prepare my queries.  But Im not able to get at the extra fields in
> > >> > the association table this way.
>
> > >> > # Schema
> > >> >   create_table "consultants_projects", :force => true do |t|
> > >> >     t.integer "consultant_id"
> > >> >     t.intege

Re: [Rails] Using AWS RDS with Rails

2010-04-23 Thread Bill Walton
Hi Yudi,

On Fri, Apr 23, 2010 at 11:59 AM, Yudi Soesanto  wrote:

> Guys,
>
> Could you give pointer how I can use AWS RDS with rails?
>
> Is there any plugins to accomplish this?
>
>
Assuming you've already got an RDS instance set up, all you need to do is
modify your database.yml file to point to it.

HTH,
Bill

-- 
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: Best way to handle multiple tables to replace one big ta

2010-04-23 Thread Mike P.
Marnen Laibow-Koser wrote:
> Mike P. wrote:
>> Hello,
>> 
>> I've decided to use multiple tables for an entity (e.g. "todo_items1,"
>> "todo_items2," "todo_items3," etc.), instead of just one main table
>> which could end up having a lot of rows (e.g. just "todo_items"). I'm
>> doing this to try and to avoid a potential future performance drop that
>> could come with having too many rows in one table.
> 
> Robert already said it, and I agree: DO NOT DO THIS.  Any decent DB 
> system is designed to handle tables in the millions of rows without 
> breathing hard.  Just index your tables properly and make sure your 
> queries are efficient.
> 
> If you have to use your DB's sharding features at some point, go for it. 
> But don't even think of doing this in the app layer.
> 
> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> mar...@marnen.org

Hi Marnen,

Thank you also for your post and advice. It actually made me think more 
about this. So you're saying that even if I had millions of records in a 
table, and was noticing a decrease in performance, that I shouldn't 
split up the tables this way? Would a shard be the only option?

One of the things that I keep coming back to when I think about the 
single-table option is that one of the fields will be rather large, like 
a blog-post in size. And I plan on indexing that to make it searchable. 
Also, there's a lot of insertions and deletions. Does it still make 
sense to include all of that in a single table? Or does that change any 
of your advice?

I agree that this is an application layer split, sort of; but I don't 
think that this particular split is a bad thing.

If I did this in pure Ruby, for example, I'm guessing that the effect 
would be minimal (just one class/method that looks up the correct table, 
and returns the object for that table). What's (potentially) making the 
app layer bloated is all of the unused 'has_many' attributes since I'm 
trying to stick with Rails. I really do want to be able to take 
advantage of the nice Rails methods and functionality... I'm just trying 
to avoid having a bunch of unused associations for each user object.

Is there maybe a way to unload a 'has_many' association for an object? 
Or perhaps call 'has_many' inside of a user-specific method or 
something? Like

if @current_user.todo_table_number == 1
  has_many :todo_items1
elsif @current_user.todo_table_number == 2
  has_many :todo_items2
elsif ...


Anyway, the reason why I'm trying to stay away from the database-layer 
stuff is because they seem to be a bit 'much' right now, and also can 
apparently cause problems. For example, even adding foreign keys at the 
database-layer can evidently cause issues with testing, and sometimes 
they get lost in db:push/db:pull calls.

Okay, how about this. Let's say that instead of my original post, I 
posted saying that I have a large table with 7 million+ rows that keeps 
growing. I had already split up the tables in the manner mentioned in 
the original post. Also, let's say that I really wanted to stick with 
the-Rails-way and was opposed to sharding. What would your advice be 
then?

Thanks again for your help,
Mike
-- 
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: link_to with resource routes in helper file?

2010-04-23 Thread Tim
sorry  under rspec that is with rails 2.3.5

On Apr 23, 3:26 pm, Tim  wrote:
> Hey all!
>
> Any pointers on doing something like:
>
>   link_to "Comments", comments_path
>
> from within a helper file just like you can do from a view?
>
> Thanks in advance!
>
> --
> 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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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] link_to with resource routes in helper file?

2010-04-23 Thread Tim
Hey all!

Any pointers on doing something like:

  link_to "Comments", comments_path

from within a helper file just like you can do from a view?

Thanks in advance!

-- 
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: Zoomable chart

2010-04-23 Thread Marnen Laibow-Koser
Tig wrote:
> Hi, I would like to create an interactive bubble chart from a Rails-
> based database. I've spent quite a lot of time browsing the posts both
> here and on rubyforums for similar queries, but haven't really found a
> definitive answer yet. I would like each point to be clickable, and
> would like users to be able to zoom and navigate within the chart. We
> would prefer not to use Flash for this project. The database is
> sizeable (potentially 10,000+ points), and rapid rendering of the
> chart would also be desirable!

You probably won't get a good answer here, because this is basically not 
a Rails question.  You need to find or create a chart you like, then set 
up your Rails app to deliver the XML or JSON that the chart needs.

> 
> Thanks in advance,
> 
> Tig

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
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: Rails internals ?.

2010-04-23 Thread Marnen Laibow-Koser
Dani Dani wrote:
> Thank you all.
> 
> Why not use scaffold in production ?

It's underpowered and inflexible.  By the time you get to having a 
production-ready app, you will probably have customized or completely 
removed your scaffold.

I tend not to use scaffolding even when I'm trying to quickly set up a 
new app.  I wouldn't mourn it if it were removed from Rails.

If you want something scaffold-like with more utility, check out 
ActiveScaffold.  It's probably not what you want for end-user-facing 
stuff, but it's nice for things like admin interfaces.

> Dani

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
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] Zoomable chart

2010-04-23 Thread Tig
Hi, I would like to create an interactive bubble chart from a Rails-
based database. I've spent quite a lot of time browsing the posts both
here and on rubyforums for similar queries, but haven't really found a
definitive answer yet. I would like each point to be clickable, and
would like users to be able to zoom and navigate within the chart. We
would prefer not to use Flash for this project. The database is
sizeable (potentially 10,000+ points), and rapid rendering of the
chart would also be desirable!

Thanks in advance,

Tig

-- 
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: Rails internals ?.

2010-04-23 Thread Dani Dani
Thank you all.

Why not use scaffold in production ?
Dani
-- 
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: script/server not working, I can't setup my local environment.

2010-04-23 Thread Matt
Just as an update, when trying to install oauth_client by itself, it
gives the error that it can't find the gem locally or in a repo

On Apr 23, 5:06 am, Frederick Cheung 
wrote:
> On Apr 23, 5:12 am, Matt  wrote:
>
> > Hey guys,
>
> > I've been trying to get my local env up and running on my new machine,
> > I never really figured out how I did it last time, and this time its a
> > nightmare. Every time I go to run script/server in my project file, I
> > get this error below which asks about certain gems being required but
> > I guarantee they are installed. I just don't know what to do anymore,
> > I am more a designer than anything else, can someone please help me
> > figure out whats up?
>
> do you have both oauth_client & vimeo ?
>
> Fred
>
>
>
>
>
> > => Booting WEBrick
> > => Rails 2.3.5 application starting 
> > onhttp://0.0.0.0:3000/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/...
> > gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is
> > deprecated and will be removed on or after August 2010.  Use
> > #requirement
> > no such file to load -- oauth_client
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `gem_original_require'
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:521:in `new_constants_in'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /Users/Matt/.gem/ruby/1.8/gems/vimeo-1.1.0/lib/vimeo.rb:6
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `gem_original_require'
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:521:in `new_constants_in'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/
> > gem_dependency.rb:208:in `load'
> > /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> > 307:in `load_gems'
> > /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> > 307:in `each'
> > /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> > 307:in `load_gems'
> > /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> > 164:in `process'
> > /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> > 113:in `send'
> > /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> > 113:in `run'
> > /Users/Matt/Sites/statlr/config/environment.rb:9
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `gem_original_require'
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:521:in `new_constants_in'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:
> > 84
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `gem_original_require'
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `require'
> > script/server:3
> > no such file to load -- oauth_client
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `gem_original_require'
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:521:in `new_constants_in'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /Users/Matt/.gem/ruby/1.8/gems/vimeo-1.1.0/lib/vimeo.rb:6
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `gem_original_require'
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:521:in `new_constants_in'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/
> > gem_d

[Rails] Re: script/server not working, I can't setup my local environment.

2010-04-23 Thread Matt
I believe I do yes, I keep running rake gems:install and installing
them individually and it still throws this error :(

On Apr 23, 5:06 am, Frederick Cheung 
wrote:
> On Apr 23, 5:12 am, Matt  wrote:
>
> > Hey guys,
>
> > I've been trying to get my local env up and running on my new machine,
> > I never really figured out how I did it last time, and this time its a
> > nightmare. Every time I go to run script/server in my project file, I
> > get this error below which asks about certain gems being required but
> > I guarantee they are installed. I just don't know what to do anymore,
> > I am more a designer than anything else, can someone please help me
> > figure out whats up?
>
> do you have both oauth_client & vimeo ?
>
> Fred
>
>
>
>
>
> > => Booting WEBrick
> > => Rails 2.3.5 application starting 
> > onhttp://0.0.0.0:3000/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/...
> > gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is
> > deprecated and will be removed on or after August 2010.  Use
> > #requirement
> > no such file to load -- oauth_client
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `gem_original_require'
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:521:in `new_constants_in'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /Users/Matt/.gem/ruby/1.8/gems/vimeo-1.1.0/lib/vimeo.rb:6
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `gem_original_require'
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:521:in `new_constants_in'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/
> > gem_dependency.rb:208:in `load'
> > /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> > 307:in `load_gems'
> > /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> > 307:in `each'
> > /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> > 307:in `load_gems'
> > /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> > 164:in `process'
> > /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> > 113:in `send'
> > /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> > 113:in `run'
> > /Users/Matt/Sites/statlr/config/environment.rb:9
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `gem_original_require'
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:521:in `new_constants_in'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:
> > 84
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `gem_original_require'
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `require'
> > script/server:3
> > no such file to load -- oauth_client
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `gem_original_require'
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:521:in `new_constants_in'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /Users/Matt/.gem/ruby/1.8/gems/vimeo-1.1.0/lib/vimeo.rb:6
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `gem_original_require'
> > /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:521:in `new_constants_in'
> > /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> > active_support/dependencies.rb:156:in `require'
> > /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/
> > gem_dependency.rb:

[Rails] Re: Best way to handle multiple tables to replace one big ta

2010-04-23 Thread Marnen Laibow-Koser
Mike P. wrote:
> Hello,
> 
> I've decided to use multiple tables for an entity (e.g. "todo_items1,"
> "todo_items2," "todo_items3," etc.), instead of just one main table
> which could end up having a lot of rows (e.g. just "todo_items"). I'm
> doing this to try and to avoid a potential future performance drop that
> could come with having too many rows in one table.

Robert already said it, and I agree: DO NOT DO THIS.  Any decent DB 
system is designed to handle tables in the millions of rows without 
breathing hard.  Just index your tables properly and make sure your 
queries are efficient.

If you have to use your DB's sharding features at some point, go for it. 
But don't even think of doing this in the app layer.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
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: Logging in Production on Network Solutions

2010-04-23 Thread jrq
Apache/2.2.8 (Unix) / Phusion_Passenger/2.0.6

On Apr 23, 3:51 pm, "Charles A. Lopez" 
wrote:
> may i ask what web server you're using?
>
> On 23 April 2010 08:48, jrq  wrote:
>
>
>
> > Network Solutions is really beginning to try my patience.   Can anyone
> > help me with get logs to work in a Production environment hosted on
> > Network Solutions?
>
> > I've edited envionment.rb to include "config.log_level = :debug",
> > restarted the app. but I still get nothing in the log directory.
>
> > --
> > 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.
>
> --
> Charles A. Lopez
> charlesalo...@gmail.com
>
> What's your vision for your organization?
> What's your biggest challenge?
>
> Let's talk.
> (IBM Partner)
>
> --
> 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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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: Logging in Production on Network Solutions

2010-04-23 Thread jrq
Apache/2.2.8 (Unix) / Phusion_Passenger/2.0.6

On Apr 23, 3:51 pm, "Charles A. Lopez" 
wrote:
> may i ask what web server you're using?
>
> On 23 April 2010 08:48, jrq  wrote:
>
>
>
> > Network Solutions is really beginning to try my patience.   Can anyone
> > help me with get logs to work in a Production environment hosted on
> > Network Solutions?
>
> > I've edited envionment.rb to include "config.log_level = :debug",
> > restarted the app. but I still get nothing in the log directory.
>
> > --
> > 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.
>
> --
> Charles A. Lopez
> charlesalo...@gmail.com
>
> What's your vision for your organization?
> What's your biggest challenge?
>
> Let's talk.
> (IBM Partner)
>
> --
> 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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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.



Re: [Rails] Logging in Production on Network Solutions

2010-04-23 Thread Charles A. Lopez
may i ask what web server you're using?

On 23 April 2010 08:48, jrq  wrote:

> Network Solutions is really beginning to try my patience.   Can anyone
> help me with get logs to work in a Production environment hosted on
> Network Solutions?
>
> I've edited envionment.rb to include "config.log_level = :debug",
> restarted the app. but I still get nothing in the log directory.
>
> --
> 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.
>
>


-- 
Charles A. Lopez
charlesalo...@gmail.com

What's your vision for your organization?
What's your biggest challenge?

Let's talk.
(IBM Partner)

-- 
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: Logging in Production on Network Solutions

2010-04-23 Thread jrq
Yes.  There's nothing in the environments/production.rb that should
affect it:

# Settings specified here will take precedence over those in config/
environment.rb

# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true

# Use a different logger for distributed setups
# config.logger = SyslogLogger.new

# Full error reports are disabled and caching is turned on
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.action_view.cache_template_loading= true

# Use a different cache store in production
# config.cache_store = :mem_cache_store

# Enable serving of images, stylesheets, and javascripts from an asset
server
# config.action_controller.asset_host  = "http://
assets.example.com"

# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false

On Apr 23, 12:35 pm, Colin Law  wrote:
> On 23 April 2010 13:48, jrq  wrote:
>
> > Network Solutions is really beginning to try my patience.   Can anyone
> > help me with get logs to work in a Production environment hosted on
> > Network Solutions?
>
> > I've edited envionment.rb to include "config.log_level = :debug",
> > restarted the app. but I still get nothing in the log directory.
>
> Have you checked it is not being overridden in environments/production.rb?
>
> Colin
>
> --
> 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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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: Best way to handle multiple tables to replace one big ta

2010-04-23 Thread Mike P.
Robert Walker wrote:
> Mike P. wrote:
>> Hello,
>> 
>> I've decided to use multiple tables for an entity (e.g. "todo_items1,"
>> "todo_items2," "todo_items3," etc.), instead of just one main table
>> which could end up having a lot of rows (e.g. just "todo_items"). I'm
>> doing this to try and to avoid a potential future performance drop that
>> could come with having too many rows in one table.
> 
> This sounds to me like the very definition of "Premature Optimization."
> 
> http://en.wikipedia.org/wiki/Program_optimization#When_to_optimize
> 
> What you're describing is called "Database Sharding."
> 
> http://en.wikipedia.org/wiki/Shard_(database_architecture)
> 
> However, I would very highly recommend the simpler design, unless you 
> are having scaling problems right now. It sounds like you're at the 
> beginning stages of design so I doubt that is the case.
> 
> Putting optimization before design leads to complex, difficult to 
> maintain systems. At present you have no verifiable metrics to determine 
> whether the more complex design will ever be needed. Why pay the cost 
> for it now? Wouldn't it be smarter to implement optimizations after you 
> have solid metrics to prove the need for said optimizations?

Hi Robert,

Thank you for your response. I totally agree that not everything needs 
to be optimized upfront, but there's also a problem with waiting for the 
metrics: When I have those metrics that prove the need for these 
optimizations, the performance will already be getting affected. And 
depending on how closely the performance is being watched, it could 
already be something that's annoying to the user, and that's not good.

That, and I think it's easier, in this case, to have this built-in from 
the start, rather than having to add this in later on which would 
(probably) cause me to have to shut down the database when it comes time 
to do the actual upgrade, which would be another inconvenience for the 
user. I'd also like to avoid having to move the pre-existing data around 
for optimization, which I know I'd end up doing if I postpone this.

Creating the multiple tables now, when there's no real data, takes care 
of those issues and helps me get the infrastructure in place and 
well-tested.

Also, splitting up the tables upfront will help to delay the need for 
some future optimization. since index performance starts to drop once 
the tables get too large (e.g. around one million records or so). If I 
make five tables then, in theory, that index performance decrease 
shouldn't happen until those tables reach 1 million+ records, which will 
take longer since the data is being spread across the tables.

As for sharding, thank you for the advice, but it seems like an even 
more complicated solution than just using a few additional tables. When 
looking up sharding, I found a number people that recommend against it 
unless it's absolutely necessary. So, yes, sharding would be a good 
thing to wait for metrics before implementing it.

The links I found for the cons of sharding are from Updates 2, 3 and 4 
at the following site:

http://highscalability.com/unorthodox-approach-database-design-coming-shard

So, I'm still thinking that I want to split up the tables upfront. I do 
agree that "premature optimization" isn't always a good thing, but it's 
not always a bad thing either. :)

(Also, on another note, I'm using PostgreSQL and I only have the one 
database server, so moving a table/database off to another server isn't 
an option right now. [And I know that the shards can be on the same 
server, but it doesn't look like something I want to implement right 
now.])

So, any advice on a good Ruby/Rails way to handle this?

Thanks,
Mike

-- 
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: session[:foo] size limit?

2010-04-23 Thread Frederick Cheung


On Apr 23, 4:34 pm, Hans Hartmann  wrote:
> > With a rails app generated by a recent version of rails you'll have an
> > initializer called something like session.rb or session_store.rb in
> > config/initializers that sets up the session
>
> I've got a rails app generated by a recent version of rails but no
> initializer caller session.rb ... not even an entry in other
> initializers.
> Can it be anywhere else?

Previously that stuff was an environment.rb - I was just pointing that
out as a template for how you set that stuff up .

Fred
>
> Thanks
> Hans
> --
> Posted viahttp://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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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] boot.rb:4:in `require

2010-04-23 Thread viglu
Hello,

I'm new to rails 3 beta 3

I create my first app with

# rails firsttest

then

# rails s
/home/luc/firsttest/config/boot.rb:4:in `require': no such file to
load -- bundler (LoadError)
from /home/luc/firsttest/config/boot.rb:4:in `'
from script/rails:8:in `require'
from script/rails:8:in `'

I don't know what's wrong.

Can anyone help me ?

Regards,
Luc

-- 
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.



Re: [Rails] Heroku deployment...

2010-04-23 Thread anton effendi
please read
http://stackoverflow.com/questions/1824759/git-push-heroku-master-permission-denied-on-vista
and follow all step

On Sat, Apr 24, 2010 at 1:28 AM, shyam mohan wrote:

> Hi anton effend
> thanks for reply...
> i tried this
> http://docs.heroku.com/keys
>
> please see this ...here I want to add public key ...heroku
> keys:add radiant.pub
> Uploading ssh public key radiant.pub
>
> [r...@fl2 heroku_radiant]# git push heroku master
>
> Permission denied (publickey).
> fatal: The remote end hung up unexpectedly
> when I use
> > heroku keys
> === 2 keys for shyammohankano...@gmail.com
> ssh-rsa B3NzaC...0xx/eUzQ== sh...@fl2
> ssh-rsa B3NzaC...n9AVq2uQ== r...@fl2
>
> there are keys ... but still I getting error ...plz tell why?
>
>
> -Shyam
>
>
>
>
>
> On Tue, Apr 20, 2010 at 9:35 PM, anton effendi wrote:
>
>> please run 'heroku help'
>>
>> and look add public into heroku
>>
>> run it please..
>>
>> Thank you
>>
>> On Tue, Apr 20, 2010 at 7:57 PM, shyam mohan > > wrote:
>>
>>> Hi
>>> please help me...
>>>
>>> >git push heroku master
>>> Warning: Permanently added the RSA host key for IP address  to the list
>>> of known hosts.
>>> Permission denied (publickey).
>>> fatal: The remote end hung up unexpectedly
>>>
>>> please tell why im getting this error...
>>>  and how to correct it...
>>> I google about it but can find satisfactory  ans...
>>>
>>>
>>> -Shyam
>>>
>>>
>>>  --
>>> 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.
>>>
>>
>>
>>
>> --
>>
>> Senior Rails Developer
>> Anton Effendi - Wu You Duan
>>
>> --
>> 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.
>>
>
>  --
> 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.
>



-- 

Senior Rails Developer
Anton Effendi - Wu You Duan

-- 
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.



Re: [Rails] LOGIN INTO YAHOO - - - RAILS

2010-04-23 Thread Joshua Martin
http://developer.yahoo.com/auth/


On Fri, Apr 23, 2010 at 2:38 PM, kevid  wrote:

> hi all,
>
> Is there a way to login to yahoo programatically from my controller?
> thus the user (WITHOUT SEEING THE YAHOO LOGIN PAGE) would just  be
> logged into yahoo having provided username and password ?
>
> thoughts ??
>
> --
> 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.
>
>


-- 
_

Joshua S. Martin


CONFIDENTIALITY NOTE: This e-mail message, including any attachment(s),
contains information that may be confidential, protected by the attorney
client or other legal privileges, and or proprietary non public information.
If you are not an intended recipient of this message or an authorized
assistant to an intended recipient, please notify the sender by replying to
this message and then delete it from your system. Use, dissemination,
distribution, or reproduction of this message and or any of its attachments
(if any) by unintended recipients is not authorized and may be unlawful.

-- 
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] LOGIN INTO YAHOO - - - RAILS

2010-04-23 Thread kevid
hi all,

Is there a way to login to yahoo programatically from my controller?
thus the user (WITHOUT SEEING THE YAHOO LOGIN PAGE) would just  be
logged into yahoo having provided username and password ?

thoughts ??

-- 
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.



Re: [Rails] Heroku deployment...

2010-04-23 Thread shyam mohan
Hi anton effend
thanks for reply...
i tried this
http://docs.heroku.com/keys

please see this ...here I want to add public key ...heroku
keys:add radiant.pub
Uploading ssh public key radiant.pub

[r...@fl2 heroku_radiant]# git push heroku master
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
when I use
> heroku keys
=== 2 keys for shyammohankano...@gmail.com
ssh-rsa B3NzaC...0xx/eUzQ== sh...@fl2
ssh-rsa B3NzaC...n9AVq2uQ== r...@fl2

there are keys ... but still I getting error ...plz tell why?


-Shyam




On Tue, Apr 20, 2010 at 9:35 PM, anton effendi  wrote:

> please run 'heroku help'
>
> and look add public into heroku
>
> run it please..
>
> Thank you
>
> On Tue, Apr 20, 2010 at 7:57 PM, shyam mohan 
> wrote:
>
>> Hi
>> please help me...
>>
>> >git push heroku master
>> Warning: Permanently added the RSA host key for IP address  to the list of
>> known hosts.
>> Permission denied (publickey).
>> fatal: The remote end hung up unexpectedly
>>
>> please tell why im getting this error...
>>  and how to correct it...
>> I google about it but can find satisfactory  ans...
>>
>>
>> -Shyam
>>
>>
>>  --
>> 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.
>>
>
>
>
> --
>
> Senior Rails Developer
> Anton Effendi - Wu You Duan
>
> --
> 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.
>

-- 
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: Rails 3 associations extra attributes with lazy loading

2010-04-23 Thread Will Prater
Hi,

Sure, here is the schema, and model files.  Let me know what you
think.  Why can't I get the :select to work when using ".includes".
In the console examples below, you can see the pay_rate and bill_rate
are not present in the example using .includes.

Schema
https://gist.github.com/76e70c7f31b6dcc5cfcc

Consultant Model
https://gist.github.com/93e5858417bb14ec18c9

Project Model
https://gist.github.com/8545e9da49742b4e4dcb

Console output using .includes does not honor :select

ruby-1.8.7-p249 >
Project.includes(:consultants).first.to_json(:include => :consultants)
 => "{\"start_date\":null,\"name\":\"Widget Assembly\",\"created_at\":
\"2010-04-22T22:52:29Z\",\"updated_at\":\"2010-04-22T22:52:29Z\",
\"sales_contact_id\":null,\"id\":1,\"enabled\":true,\"client_id\":
1,\"consultants\":[{\"created_at\":\"2010-04-22T22:52:29Z\",
\"updated_at\":\"2010-04-23T02:35:58Z\",\"recruiter_contact_id\":
1,\"payclass\":2,\"id\":1,\"enabled\":true,\"phone\":\"\",\"last_name
\":\"Wright\",\"first_name\":\"Steve\",\"email\":\"st...@palmtest.com
\"}],\"end_date\":null}"


Console output using does honor :select, but uses N + 1 queries for
all the consultants in a project

ruby-1.8.7-p249 > Project.first.to_json(:include => :consultants)
 => "{\"start_date\":null,\"name\":\"Widget Assembly\",\"created_at\":
\"2010-04-22T22:52:29Z\",\"updated_at\":\"2010-04-22T22:52:29Z\",
\"sales_contact_id\":null,\"id\":1,\"enabled\":true,\"client_id\":
1,\"consultants\":[{\"start_date\":null,\"pay_rate\":\"40\",
\"created_at\":\"2010-04-22T22:52:29Z\",\"updated_at\":
\"2010-04-23T02:35:58Z\",\"recruiter_contact_id\":1,\"project_id\":
\"1\",\"consultants_projects_id\":\"1\",\"bill_rate\":\"80\",\"payclass
\":2,\"id\":1,\"enabled\":true,\"consultants_projects_enabled\":\"t\",
\"phone\":\"\",\"last_name\":\"Wright\",\"end_date\":null,\"first_name
\":\"Steve\",\"email\":\"st...@palmtest.com\"}],\"end_date\":null}"


Any help is appreciated.  Am I doing something wrong, or is this just
not supported?

-Will


On Apr 23, 7:17 am, tommy xiao  wrote:
> hi,Will
> can you use gist to provide more code? it is examine your code.
>
> 2010/4/23 tommy xiao 
>
>
>
>
>
> > interest topic. in console, use to_sql to represent SQL, Maybe found more
> > hits.
>
> > 2010/4/23 Will Prater 
>
> > More observations I've found.  The Arel includes method does not seem
> >> to respect HMT :select joins.  I'd prefer to use the "includes" lazy-
> >> laoding way, but cannot seem to get the extra attributes to come back.
>
> >> Both will return the Manager Model
> >> 
> >> ruby-1.8.7-p249 > p = Project.first.managers.first
> >>  => # >> email: nil, phone: nil, created_at: "2010-04-22 22:52:29", updated_at:
> >> "2010-04-22 22:52:29">
>
> >> ruby-1.8.7-p249 > p = Project.includes(:managers).first.managers.first
> >>  => # >> email: nil, phone: nil, created_at: "2010-04-22 22:52:29", updated_at:
> >> "2010-04-22 22:52:29">
>
> >> Notice that all the extra attributes are NOT passed
> >> ===
> >> ruby-1.8.7-p249 > p =
> >> Project.includes(:managers).first.managers.first.to_json
> >>  => "{\"created_at\":\"2010-04-22T22:52:29Z\",\"updated_at\":
> >> \"2010-04-22T22:52:29Z\",\"id\":1,\"phone\":null,\"last_name\":
> >> \"Scissorhands\",\"first_name\":\"Edward\",\"email\":null}"
>
> >> Notice that all the extra attributes are passed
> >> ===
> >> ruby-1.8.7-p249 > p = Project.first.managers.first.to_json
> >>  => "{\"created_at\":\"2010-04-22T22:52:29Z\",\"updated_at\":
> >> \"2010-04-22T22:52:29Z\",\"project_id\":\"1\",\"primary\":\"t\",
> >> \"manager_id\":\"1\",\"id\":1,\"phone\":null,\"last_name\":
> >> \"Scissorhands\",\"first_name\":\"Edward\",\"email\":null}"
>
> >> Here is the setup in my Model
> >> ===
> >> has_many :managers_projects
> >> has_many :managers, :through => :managers_projects,
> >>  :select => 'managers.*, managers_projects.project_id,
> >> managers_projects.manager_id, managers_projects.`primary`'
>
> >> On Apr 21, 5:00 pm, Will Prater  wrote:
> >> > Hello,
>
> >> > How can one get the extra attributes from the association table while
> >> > using lazy loading like so:
>
> >> > # I have a HMT (rails3) association and am using the includes method
> >> > to prepare my queries.  But Im not able to get at the extra fields in
> >> > the association table this way.
>
> >> > # Schema
> >> >   create_table "consultants_projects", :force => true do |t|
> >> > t.integer "consultant_id"
> >> > t.integer "project_id"
> >> > t.integer "pay_rate"
> >> > t.integer "bill_rate"
> >> > t.date"start_date"
> >> > t.date"end_date"
> >> > t.boolean "enabled",   :default => true
> >> >   end
>
> >> >   add_index "consultants_projects", ["consultant_id"], :name =>
> >> > "index_consultants_projects_on_consultant_id"
> >> >

[Rails] Re: Best way to handle multiple tables to replace one big ta

2010-04-23 Thread Robert Walker
Mike P. wrote:
> Hello,
> 
> I've decided to use multiple tables for an entity (e.g. "todo_items1,"
> "todo_items2," "todo_items3," etc.), instead of just one main table
> which could end up having a lot of rows (e.g. just "todo_items"). I'm
> doing this to try and to avoid a potential future performance drop that
> could come with having too many rows in one table.

This sounds to me like the very definition of "Premature Optimization."

http://en.wikipedia.org/wiki/Program_optimization#When_to_optimize

What you're describing is called "Database Sharding."

http://en.wikipedia.org/wiki/Shard_(database_architecture)

However, I would very highly recommend the simpler design, unless you 
are having scaling problems right now. It sounds like you're at the 
beginning stages of design so I doubt that is the case.

Putting optimization before design leads to complex, difficult to 
maintain systems. At present you have no verifiable metrics to determine 
whether the more complex design will ever be needed. Why pay the cost 
for it now? Wouldn't it be smarter to implement optimizations after you 
have solid metrics to prove the need for said optimizations?
-- 
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: Ordering by associated columns (pleeease help)

2010-04-23 Thread Anubhaw Prakash
Sumeet Panchal wrote:
> Hi,
> 
> I am stuck pretty bad please help. any comment is helpful.
> I have say three models
> Customer(fields are id, name, cell_phone, primary_address_id)
>belongs_to :primary_address, :class_name =>
> 'CustomerAddress', :foreign_key => 'primary_address_id'
>has_many :customer_addresses
> end
> 
> CustomerAddress(fields city, customer_id, state)
>belongs_to :customer
> end
> 
> so basically I have many addresses for a customer, and one of which is
> primary address. so I have this relations ship
> customer.primary_address.
> 
> Now I want to write a query by using find or paginate. like:
> Customer.find [arra of id], :order => "primary_address.city ASC"
> The problem is that it is not ordering by associated columns. It says
> no column primary_address.city found.
> I am trying to use include but it do not works, :join how can I use
> it. Please help is there any way to order by associated columns.
> 
> Thanks
> Sumeet Panchal

You can use join as Customer.find(:all, :joins => "customers inner join
customer_address as b on customers.primary_address_id=b.id") and in this 
you can use ordering.

Anubhaw
-- 
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] Best way to handle multiple tables to replace one big table?

2010-04-23 Thread Mike P.
Hello,

I've decided to use multiple tables for an entity (e.g. "todo_items1,"
"todo_items2," "todo_items3," etc.), instead of just one main table
which could end up having a lot of rows (e.g. just "todo_items"). I'm
doing this to try and to avoid a potential future performance drop that
could come with having too many rows in one table.

With that, I'm looking for a good way to handle this in Rails, mainly by
trying to avoid loading a bunch of unused associations for each User
object. I'm guessing that other have done something similar, so there's
probably a few good tips/recommendations out there.

(I know that I could use a partition for this, but, for now, I've
decided to go the 'multiple tables' route.)

Each user has their todo_items placed into a specific table. The user's
"todo items" table is set when the user is created, and all of their
todo_items go into the same table. The data in their todo items
collection is private, so when it comes time to process a users
todo_items, I'll only have to look at one table.

One thing I don't particularly want to have is a bunch of unused
associations in the User class. Right now, it looks like I'd have to do
the following:

class User < ActiveRecord::Base
  has_many :todo_items1, :todo_items2, :todo_items3, :todo_items4,
:todo_items5
end

class todo_items1 < ActiveRecord::Base
  belongs_to :user
end

class todo_items2 < ActiveRecord::Base
  belongs_to :user
end

class todo_items3 < ActiveRecord::Base
  belongs_to :user
end

The thing is, for each individual user, only one of the "todo items"
tables would be usable/applicable/accessible since all of a user's
todo_items are stored in the same table. This means only one of the
associations would be in use at any time and all of the other "has_many
:todo_itemsX" associations that were loaded would be a waste.

For example, with a user.id of 2, I'd only need
"todo_items3.find_by_text('search_word')", but the way I'm thinking of
setting this up (see above), I'd still have access to todo_items1,
todo_items2, todo_items4 and todo_items5.

I'm thinking that these "extra associations" adds extra overhead and
makes each User object's size in memory much bigger than it has to be.

Also, there's a bunch of stuff that Ruby/Rails is doing in the
background which may make this implementation. For example, I'm guessing
that there could be some additional method call/lookup overhead for each
User object, since it has to load all of those associations, which in
turn creates all of those nice, dynamic model accessor methods like
"User.find_by_something."

I don't really know Ruby/Rails does internally with all of those
has_many associations though, so maybe it's not so bad. But right now
I'm thinking that it's really wasteful, and that there may just be a
better, more efficient way of doing this.

So, a few questions:

1) Is there's some sort of special Ruby/Rails methodology that could be
applied to this 'multiple tables to represent one entity' scheme? Are
there any 'best practices' for this?

2) Is it really bad to have so many unused has_many associations for
each object? Is there a better way to do this?

3) Does anyone have any advice on how to abstract the fact that there's
multiple "todo items" tables behind a single todo_items model/class? For
example, so I can call "todo_items.find_by_text('search_phrase')"
instead of "todo_items3.find_by_text('search_phrase')," or even
"@user.todo_items?"

Thank you!
-- 
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] Ordering by associated columns (pleeease help)

2010-04-23 Thread Sumeet Panchal
Hi,

I am stuck pretty bad please help. any comment is helpful.
I have say three models
Customer(fields are id, name, cell_phone, primary_address_id)
   belongs_to :primary_address, :class_name =>
'CustomerAddress', :foreign_key => 'primary_address_id'
   has_many :customer_addresses
end

CustomerAddress(fields city, customer_id, state)
   belongs_to :customer
end

so basically I have many addresses for a customer, and one of which is
primary address. so I have this relations ship
customer.primary_address.

Now I want to write a query by using find or paginate. like:
Customer.find [arra of id], :order => "primary_address.city ASC"
The problem is that it is not ordering by associated columns. It says
no column primary_address.city found.
I am trying to use include but it do not works, :join how can I use
it. Please help is there any way to order by associated columns.

Thanks
Sumeet Panchal

-- 
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] Using AWS RDS with Rails

2010-04-23 Thread Yudi Soesanto
Guys,

Could you give pointer how I can use AWS RDS with rails?

Is there any plugins to accomplish this?

Thank you for you help.

Yudi

-- 
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.



Re: [Rails] Rails internals ?.

2010-04-23 Thread Colin Law
On 23 April 2010 12:43, Dani Dani  wrote:
> Hi. I'm new to ROR, I bought the book "Agile Web Development with Rails,
> Third Edition" and followed the depot example. I still can't imagine me
> developing a rails application after that. There are many things that
> are not explained, and many things that are mentioned, e.g. Rails
> methods, helpers, ..., which I don't know where to find them if I was
> looking for them.
>...

One idea is to hang about here, any question that you understand (at
least vaguely), then attempt to understand the answers.  This will
rapidly lead you to a greater depth of knowledge.  In no time you will
find yourself answering questions (provided you do not mind
occasionally making a fool of yourself of course).

Colin

-- 
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] Stop printing style with auto_complete

2010-04-23 Thread rtacconi
auto_complete prints the style just near the input box but the XHTML
does not validates. Is there a way to stop autocomple printing the
style code and move into the CSS file?

Thanks.

-- 
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.



Re: [Rails] Logging in Production on Network Solutions

2010-04-23 Thread Colin Law
On 23 April 2010 13:48, jrq  wrote:
> Network Solutions is really beginning to try my patience.   Can anyone
> help me with get logs to work in a Production environment hosted on
> Network Solutions?
>
> I've edited envionment.rb to include "config.log_level = :debug",
> restarted the app. but I still get nothing in the log directory.

Have you checked it is not being overridden in environments/production.rb?

Colin

-- 
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] rails-3.0.0.beta3 install error on ri 'lib' ENOENT

2010-04-23 Thread Mike
Hi,

I was getting an odd error installing rails-3.0.0.beta3 on a fresh
Ubuntu 10.04 install.  The same exact error was occurring on my Ubuntu
9.10 install, so I'm sure it isn't something specific to the Ubuntu
version (nor beta for that matter).

This is the error:

m...@ubuntu:~/rubygems-1.3.6$ sudo gem1.9.1 install rails --pre
Successfully installed activesupport-3.0.0.beta3
Successfully installed activemodel-3.0.0.beta3
Successfully installed actionpack-3.0.0.beta3
Successfully installed arel-0.3.3
Successfully installed activerecord-3.0.0.beta3
Successfully installed activeresource-3.0.0.beta3
Successfully installed actionmailer-3.0.0.beta3
Successfully installed rake-0.8.7
Successfully installed railties-3.0.0.beta3
Successfully installed rails-3.0.0.beta3
10 gems installed
Installing ri documentation for activesupport-3.0.0.beta3...
Installing ri documentation for activemodel-3.0.0.beta3...
Installing ri documentation for actionpack-3.0.0.beta3...
Installing ri documentation for arel-0.3.3...
Installing ri documentation for activerecord-3.0.0.beta3...
Installing ri documentation for activeresource-3.0.0.beta3...
Installing ri documentation for actionmailer-3.0.0.beta3...
Installing ri documentation for rake-0.8.7...
Installing ri documentation for railties-3.0.0.beta3...
Installing ri documentation for rails-3.0.0.beta3...
ERROR:  While executing gem ... (Errno::ENOENT)
No such file or directory - lib

I tried creating lib directory in the following location to see if it
would resolve the issue, and it seems to have worked:

/usr/lib/ruby1.9.1/gems/1.9.1/gems/rails-3.0.0.beta3/lib

Any idea why gem/rails/ri didn't try to create the lib directory prior
to attempting the install?

Full debug/backtrace below.

m...@ubuntu:~/rubygems-1.3.6$ sudo gem1.9.1 install rails --pre --
debug --backtrace
Exception `NameError' at /usr/local/lib/site_ruby/1.9.1/rubygems/
command_manager.rb:163 - uninitialized constant
Gem::Commands::InstallCommand
Exception `LoadError' at /usr/local/lib/site_ruby/1.9.1/rubygems/
gem_openssl.rb:40 - no such file to load -- openssl
Exception `Gem::LoadError' at /usr/local/lib/site_ruby/1.9.1/
rubygems.rb:777 - Could not find RubyGem test-unit (>= 0)

Exception `Gem::LoadError' at /usr/local/lib/site_ruby/1.9.1/
rubygems.rb:777 - Could not find RubyGem sources (> 0.0.1)

Exception `NoMethodError' at /usr/local/lib/site_ruby/1.9.1/rubygems/
package/tar_input.rb:49 - undefined method `readpartial' for
#
Exception `IOError' at /usr/local/lib/site_ruby/1.9.1/rubygems/
format.rb:50 - closed stream
Exception `Errno::EEXIST' at /usr/lib/ruby/1.9.1/fileutils.rb:243 -
File exists - /usr/lib/ruby1.9.1/gems/1.9.1
Exception `Errno::EEXIST' at /usr/lib/ruby/1.9.1/fileutils.rb:243 -
File exists - /usr/lib/ruby1.9.1/gems/1.9.1/gems/rails-3.0.0.beta3
Exception `Errno::EEXIST' at /usr/lib/ruby/1.9.1/fileutils.rb:243 -
File exists - /usr/lib/ruby1.9.1/gems/1.9.1/gems/rails-3.0.0.beta3/bin
Successfully installed rails-3.0.0.beta3
1 gem installed
Exception `Gem::LoadError' at /usr/local/lib/site_ruby/1.9.1/
rubygems.rb:777 - Could not find RubyGem rdoc (>= 0)

Exception `Errno::ENOENT' at /usr/lib/ruby/1.9.1/fileutils.rb:1203 -
No such file or directory - /usr/lib/ruby1.9.1/gems/1.9.1/doc/
rails-3.0.0.beta3/ri
Exception `Errno::ENOENT' at /usr/lib/ruby/1.9.1/fileutils.rb:1203 -
No such file or directory - /usr/lib/ruby1.9.1/gems/1.9.1/doc/
rails-3.0.0.beta3/ri
Exception `Errno::ENOENT' at /usr/lib/ruby/1.9.1/fileutils.rb:1298 -
No such file or directory - /usr/lib/ruby1.9.1/gems/1.9.1/doc/
rails-3.0.0.beta3/ri
Installing ri documentation for rails-3.0.0.beta3...
Exception `Errno::ENOENT' at /usr/lib/ruby/1.9.1/rdoc/options.rb:632 -
No such file or directory - lib
ERROR:  While executing gem ... (Errno::ENOENT)
No such file or directory - lib
/usr/lib/ruby/1.9.1/rdoc/options.rb:632:in `stat'
/usr/lib/ruby/1.9.1/rdoc/options.rb:632:in `block in check_files'
/usr/lib/ruby/1.9.1/rdoc/options.rb:631:in `each'
/usr/lib/ruby/1.9.1/rdoc/options.rb:631:in `check_files'
/usr/lib/ruby/1.9.1/rdoc/options.rb:539:in `parse'
/usr/lib/ruby/1.9.1/rdoc/rdoc.rb:247:in `document'
/usr/local/lib/site_ruby/1.9.1/rubygems/doc_manager.rb:184:in
`run_rdoc'
/usr/local/lib/site_ruby/1.9.1/rubygems/doc_manager.rb:156:in
`install_ri'
/usr/local/lib/site_ruby/1.9.1/rubygems/doc_manager.rb:116:in
`generate_ri'
/usr/local/lib/site_ruby/1.9.1/rubygems/commands/install_command.rb:
145:in `block in execute'
/usr/local/lib/site_ruby/1.9.1/rubygems/commands/install_command.rb:
144:in `each'
/usr/local/lib/site_ruby/1.9.1/rubygems/commands/install_command.rb:
144:in `execute'
/usr/local/lib/site_ruby/1.9.1/rubygems/command.rb:258:in `invoke'
/usr/local/lib/site_ruby/1.9.1/rubygems/command_manager.rb:134:in
`process_args'
/usr/local/lib/site_ruby/1.9.1/rubygems/command_manager.rb:104:in
`run'
/usr/local/lib/s

[Rails] Re: puzzled by Mutex lock call ..

2010-04-23 Thread Frederick Cheung


On Apr 22, 10:08 pm, Jedrin  wrote:
> I do
>
> �...@mutex = Mutex.new
>
> and then
>
> @mutex.lock
> ..
>
> @mutex.unlock

There's clearly something else going on. Can you reduce the code with
the problem to a small sample you can post in its entirety ? What is
the ActiveJob model and does the code exhibiting the problem also
manipulate instances of it ?

Fred

-- 
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.



Re: [Rails] Re: Ubuntu Linux Editor / Prettiefier

2010-04-23 Thread Greg Donald
On Fri, Apr 23, 2010 at 9:42 AM, Vladimir Rybas  wrote:
> The guy mean he could do it in NetBeans with one single move.
> Select text and Ctrl+Alt+Down, Down, Down for three copies.

That doesn't look like a "single move" to me.  *shrug*


-- 
Greg Donald
destiney.com | gregdonald.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: puzzled by Mutex lock call ..

2010-04-23 Thread wbsurf...@yahoo.com

 I basically have a job manager that runs with script/runner and is
independent of the webserver. It allows DRB connections, TCP
connections,
and has a scheduling loop. Inside the scheduling loop is where the
error sometimes happens which doesn't seem related to anything I did.

  I haven't worked on this code for awhile, but had not seen these
types of errors when I was running on Centos, I just moved the code to
Fedora ..


jobmgr = JobMgr.new


DRb.start_service('druby://' + jobmgr.ipaddr, jobmgr)


if jobmgr.tcp_port
  Thread.start do
jobmgr.get_tcp_reqs
  end
end

puts 'run'

jobmgr.run_scheduler

DRb.thread.join





On Apr 23, 12:35 am, Jeff Lewis  wrote:
> Not sure what the purpose of your use of such a mutex lock is in your
> app, but if it's something other than restricting access to some
> resource amongst some threads handled within a given instance of your
> rails app running in some process,  but in terms of rails, I don't
> think a mutex lock will do what you're thinking it will do if your
> rails app is running / can run in more than one process (ie via
> passenger or via a mongrel cluster or ...).
>
> Assuming you aren't talking about dealing with threads within a given
> process, and you really are trying to restrict access to some resource
> from potentially multiple process instances of your rails app, then
> you'll need to use a locking strategy that can be used in a multi
> process context (ie like via your app's db, or potentially via files,
> or ...).
>
> Note however that if you are only running one instance or rails, ie a
> single instance of webrick or mongrel, then your rails app is
> essentially single-threaded (running in a single process) in terms of
> requests handling.  In such a single-instance setup, you likely
> wouldn't need the use of mutex (unless your dealing with threads in
> that single process) since your app would only be able to handle one
> request at a time anyway.
>
> Jeff
>
> On Apr 22, 9:00 am, Jedrin  wrote:
>
>
>
> >  I have some code that uses and instance of Mutex and calls
> > @mutex.lock, executes some code and then does
> > unlock(). When I call lock() I get some ActiveRecord error which seems
> > unrelated.
>
> > Couldn't find ActiveJob with ID=3
> > ["/home/LGuild/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/
> > base.rb:1586:in `find_one'", "script/jobmgr.rb:107:in `lock'",
>
> >  This is on Fedora 12, I haven't a good idea on how to troubleshoot
> > this ..
>
> > --
> > 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 
> > athttp://groups.google.com/group/rubyonrails-talk?hl=en.
>
> --
> 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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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: session[:foo] size limit?

2010-04-23 Thread Hans Hartmann
> With a rails app generated by a recent version of rails you'll have an
> initializer called something like session.rb or session_store.rb in
> config/initializers that sets up the session

I've got a rails app generated by a recent version of rails but no 
initializer caller session.rb ... not even an entry in other 
initializers.
Can it be anywhere else?

Thanks
Hans
-- 
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] participar do grupo de estudo ruby on rails

2010-04-23 Thread juvencio
Quero aprender  ruby on rails

-- 
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: session[:foo] size limit?

2010-04-23 Thread Frederick Cheung


On Apr 23, 4:00 pm, Hans Hartmann  wrote:
> Do you mean something like storing the entries temporarly in a database
> with action:create and delete them when not needed anymore?
> ... I think thats pretty much confusing to store.
>
> Isn't there a possability to many strings/arrays (checkbox_values) in a
> variable?

Well that variable has to live somewhere and you don't have a huge
amount of choices in that regard.

> How can I change the session storage?
>

With a rails app generated by a recent version of rails you'll have an
initializer called something like session.rb or session_store.rb in
config/initializers that sets up the session

Fred

-- 
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: puzzled by Mutex lock call ..

2010-04-23 Thread wbsurf...@yahoo.com

 I basically have a job manager that runs with script/runner and is
independent of the webserver. It allows DRB connections, TCP
connections,
and has a scheduling loop. Inside the scheduling loop is where the
error sometimes happens which doesn't seem related to anything I did.

  I haven't worked on this code for awhile, but had not seen these
types of errors when I was running on Centos, I just moved the code to
Fedora ..


jobmgr = JobMgr.new


DRb.start_service('druby://' + jobmgr.ipaddr, jobmgr)


if jobmgr.tcp_port
  Thread.start do
jobmgr.get_tcp_reqs
  end
end

puts 'run'

jobmgr.run_scheduler

DRb.thread.join





On Apr 23, 12:35 am, Jeff Lewis  wrote:
> Not sure what the purpose of your use of such a mutex lock is in your
> app, but if it's something other than restricting access to some
> resource amongst some threads handled within a given instance of your
> rails app running in some process,  but in terms of rails, I don't
> think a mutex lock will do what you're thinking it will do if your
> rails app is running / can run in more than one process (ie via
> passenger or via a mongrel cluster or ...).
>
> Assuming you aren't talking about dealing with threads within a given
> process, and you really are trying to restrict access to some resource
> from potentially multiple process instances of your rails app, then
> you'll need to use a locking strategy that can be used in a multi
> process context (ie like via your app's db, or potentially via files,
> or ...).
>
> Note however that if you are only running one instance or rails, ie a
> single instance of webrick or mongrel, then your rails app is
> essentially single-threaded (running in a single process) in terms of
> requests handling.  In such a single-instance setup, you likely
> wouldn't need the use of mutex (unless your dealing with threads in
> that single process) since your app would only be able to handle one
> request at a time anyway.
>
> Jeff
>
> On Apr 22, 9:00 am, Jedrin  wrote:
>
>
>
> >  I have some code that uses and instance of Mutex and calls
> > @mutex.lock, executes some code and then does
> > unlock(). When I call lock() I get some ActiveRecord error which seems
> > unrelated.
>
> > Couldn't find ActiveJob with ID=3
> > ["/home/LGuild/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/
> > base.rb:1586:in `find_one'", "script/jobmgr.rb:107:in `lock'",
>
> >  This is on Fedora 12, I haven't a good idea on how to troubleshoot
> > this ..
>
> > --
> > 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 
> > athttp://groups.google.com/group/rubyonrails-talk?hl=en.
>
> --
> 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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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] Profile comments creation issue

2010-04-23 Thread Babos Catalin
Got a social network going on and I want users to comment on each others
profiles.

If you guys are so kind and point me to some tutorials or examples. Been
searching for two days now and nothing seems to work.

Found this tutorial, but it doesn`t work for me :
http://www.noupe.com/ajax/create-a-simple-twitter-app.html

Cata
-- 
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: session[:foo] size limit?

2010-04-23 Thread Hans Hartmann
Do you mean something like storing the entries temporarly in a database 
with action:create and delete them when not needed anymore?
... I think thats pretty much confusing to store.

Isn't there a possability to many strings/arrays (checkbox_values) in a 
variable?
How can I change the session storage?

Thank you very much for your suggestion.

Greets
Hans
-- 
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.



Re: [Rails] Re: Ubuntu Linux Editor / Prettiefier

2010-04-23 Thread Vladimir Rybas
>
>
> 1) Move the cursor to the start of the text you want to select.
> 2) Set a starting mark using Ctrl + Space.
> 3) Move the cursor to the end of the text you want to select.
> 4) Copy the text using Alt + w, or cut the text using Ctrl + w.
> 5) Move the cursor to wherever.
> 6) Ctrl + y to paste.
>
> Welcome to Emacs.  I couldn't imagine using something else at this point.
>
>
The guy mean he could do it in NetBeans with one single move.
Select text and Ctrl+Alt+Down, Down, Down for three copies.

That's useful. But my favorite Netbeans feature about blocks was not
copying, but moving blocks around by
Alt+Shift+Up/Down/Left/Right. I don't remember default mapping. I was doing
it like that.
Not by Ctrl-x tap tap tap Ctrl+v or V tap tap tap x tap tap P. It will save
a couple seconds each minute.
I was able to restore it on Vim. Moving blocks around with Ctrl+h,j,k,l
http://github.com/vrybas/dotvim/blob/master/rc.vim#L201

Another cool feature of Netbeans is `Navigator` window. When you see all the
methods in current file and can immediately move to the method by clicking
it's name. Got something like that on Vim by searching for /def / pattern,
display results on other window, and go to the method by entering line
number
http://github.com/vrybas/dotvim/blob/master/rc.vim#L298

That's not standard stuff for all editors. And I pretty much can't live
without it.
Let's have a little holy battle here :) Do you guys have your favorite
features unreachable or hardly unreachable from other editors?

-- 
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] Data relationships for a World Cup Football App

2010-04-23 Thread bingo bob
how would I map relationships for world cup football matches.

Currently in my app I have Countries, that's it, all 32 competing
nations are represented, with flags and details working great.

I'd like to introduce two new models (Match and Stadium).

A football match is obviously between two Countries in a Stadium.

How could I set that up best?

Country
  has_many Matches

Match
  has_many Countries
  belongs_to Stadium

Stadium
  has_many Matches


Bit confused as a Match will only ever be between two sides of course.
Do I require habtm? What's best to do here.
-- 
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: session[:foo] size limit?

2010-04-23 Thread Frederick Cheung


On Apr 23, 3:12 pm, Hans Hartmann  wrote:
> Hi there,
>
> i want to store an array of filenames in a session-variable
> (session[:foo).
> The problem is: if it reaches a current number of entries the
> application breaks.
>
> Is there a storage-limit of session-variables?
> Is it possible to extend it?
> Is there an alternative to store large strings/arrays?

It depends on the session store you are using. The default is
CookieStore, where the entire session is in the cookie, ie the maximum
size of a session is 4k (minus some overhead).
If you got for a database backed store then you're only limited by the
database and how you have setup the sessions table. If you find
yourself storing large amounts of data in the session you may want to
consider an alternative design (such as storing the data in the
database in a more direct form)

Fred
>
> Thanks 'till now
> Hans
> --
> Posted viahttp://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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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.



Re: [Rails] Re: Rails 3 associations extra attributes with lazy loading

2010-04-23 Thread tommy xiao
hi,Will
can you use gist to provide more code? it is examine your code.

2010/4/23 tommy xiao 

> interest topic. in console, use to_sql to represent SQL, Maybe found more
> hits.
>
> 2010/4/23 Will Prater 
>
> More observations I've found.  The Arel includes method does not seem
>> to respect HMT :select joins.  I'd prefer to use the "includes" lazy-
>> laoding way, but cannot seem to get the extra attributes to come back.
>>
>> Both will return the Manager Model
>> 
>> ruby-1.8.7-p249 > p = Project.first.managers.first
>>  => #> email: nil, phone: nil, created_at: "2010-04-22 22:52:29", updated_at:
>> "2010-04-22 22:52:29">
>>
>> ruby-1.8.7-p249 > p = Project.includes(:managers).first.managers.first
>>  => #> email: nil, phone: nil, created_at: "2010-04-22 22:52:29", updated_at:
>> "2010-04-22 22:52:29">
>>
>>
>> Notice that all the extra attributes are NOT passed
>> ===
>> ruby-1.8.7-p249 > p =
>> Project.includes(:managers).first.managers.first.to_json
>>  => "{\"created_at\":\"2010-04-22T22:52:29Z\",\"updated_at\":
>> \"2010-04-22T22:52:29Z\",\"id\":1,\"phone\":null,\"last_name\":
>> \"Scissorhands\",\"first_name\":\"Edward\",\"email\":null}"
>>
>>
>> Notice that all the extra attributes are passed
>> ===
>> ruby-1.8.7-p249 > p = Project.first.managers.first.to_json
>>  => "{\"created_at\":\"2010-04-22T22:52:29Z\",\"updated_at\":
>> \"2010-04-22T22:52:29Z\",\"project_id\":\"1\",\"primary\":\"t\",
>> \"manager_id\":\"1\",\"id\":1,\"phone\":null,\"last_name\":
>> \"Scissorhands\",\"first_name\":\"Edward\",\"email\":null}"
>>
>>
>> Here is the setup in my Model
>> ===
>> has_many :managers_projects
>> has_many :managers, :through => :managers_projects,
>>  :select => 'managers.*, managers_projects.project_id,
>> managers_projects.manager_id, managers_projects.`primary`'
>>
>>
>>
>> On Apr 21, 5:00 pm, Will Prater  wrote:
>> > Hello,
>> >
>> > How can one get the extra attributes from the association table while
>> > using lazy loading like so:
>> >
>> > # I have a HMT (rails3) association and am using the includes method
>> > to prepare my queries.  But Im not able to get at the extra fields in
>> > the association table this way.
>> >
>> > # Schema
>> >   create_table "consultants_projects", :force => true do |t|
>> > t.integer "consultant_id"
>> > t.integer "project_id"
>> > t.integer "pay_rate"
>> > t.integer "bill_rate"
>> > t.date"start_date"
>> > t.date"end_date"
>> > t.boolean "enabled",   :default => true
>> >   end
>> >
>> >   add_index "consultants_projects", ["consultant_id"], :name =>
>> > "index_consultants_projects_on_consultant_id"
>> >   add_index "consultants_projects", ["project_id"], :name =>
>> > "index_consultants_projects_on_project_id"
>> >
>> > # Model
>> > class Project < ActiveRecord::Base
>> >   has_many :managers_projects
>> >   has_many :managers, :through => :managers_projects
>> >
>> >   # We want all the extra fields on the consultants_projects
>> > association
>> >   has_many :consultants_projects
>> >   has_many :consultants,
>> > :through => :consultants_projects,
>> > :select => 'consultants.*, consultants.id,'+
>> > 'consultants_projects.id as consultants_projects_id, '
>> > +
>> > 'consultants_projects.project_id,' +
>> > 'consultants_projects.pay_rate,' +
>> > 'consultants_projects.pay_rate,' +
>> > 'consultants_projects.bill_rate,' +
>> > 'consultants_projects.start_date,' +
>> > 'consultants_projects.end_date,' +
>> > 'consultants_projects.enabled AS
>> > consultants_projects_enabled'
>> >
>> > end
>> >
>> > # c = Consultant.includes(:projects)
>> > # c.first.projects
>> > #
>> > # Does not include the extra fields like pay_rate, bill_rate etc that
>> > are stored in the association table.
>> >
>> > --
>> > 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 athttp://
>> groups.google.com/group/rubyonrails-talk?hl=en.
>>
>> --
>> 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.
>>
>>
>
>
> --
> tommy xiao
> E-mail: xiaods(AT)gmail.com
>



-- 
tommy xiao
E-mail: xiaods(AT)gmail.com

-- 
You received this message because you are subscribed to the Google Groups 

[Rails] session[:foo] size limit?

2010-04-23 Thread Hans Hartmann
Hi there,

i want to store an array of filenames in a session-variable
(session[:foo).
The problem is: if it reaches a current number of entries the
application breaks.

Is there a storage-limit of session-variables?
Is it possible to extend it?
Is there an alternative to store large strings/arrays?

Thanks 'till now
Hans
-- 
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: Rails internals ?.

2010-04-23 Thread Marnen Laibow-Koser
Ar Chron wrote:
> Dani Dani wrote:
>> Thanky you both Marnen & Anubhaw.
>> 
>> I did run the depot example application and even used debugger to see 
>> things from "inside", but still felt like someone who types in what he 
>> was told. The feeling is still there, if I had to do it myself, there 
>> are things I wouldN't know even they exist if they were not mentioned in 
>> the book. That is what I ment when I ask - where is the collection of 
>> all the methodes, helpers, ... of rails. I'll go to those sites you both 
>> have mentioned. I'm sure I'll come with further questions.
>> I do apprciate your quick answer and your motivation to help. Thank you 
>> !.
>> Dani.
> 
> So start your own project. On something you already know, so your not 
> focused on "what data do I need", or "who are the users", or "how is the 
> data organized" - you know, all those domain knowledge questions that 
> are usually the most important things, and can instead focus on "how do 
> I do this in Rails".
> 
> One of the most useful things I did early on was to scaffold a 
> rudimentary application for a person's information, then read through 
> and look at all the scaffolded routines, etc to see how rails wants to 
> work.

Hey, good advice (well, except that I usually counsel beginners away 
from scaffolding)!  My first Rails project (after a false start) was a 
complete rewrite of an app I'd already created in PHP.  I deliberately 
didn't copy the backend structure -- I wanted to make sure I used Rails 
as Rails -- but I did basically copy the UI exactly.  It was a great 
learning experience, because I already knew how the app was supposed to 
work and could focus on the framework.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
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.



Re: [Rails] how to display error messages for a child resource that failed validation

2010-04-23 Thread Matthew Hillsborough
Michael,

Thank you for this, I will try it right away.

Mind if I ask where the best place to put this code in as a best practice
for Rails?

Matthew

On Fri, Apr 23, 2010 at 5:49 AM, Michael Pavling  wrote:

> On 23 April 2010 01:23, Matthew Hillsborough
>  wrote:
> > That is what I can't figure out. Why am I getting Bars is invalid
> > versus the error messages displayed above, ["Real can't be blank",
> > "Real you must supply a valid email"]  etc.
> >
> > How do I have this output the real error messages so the user has some
> > insight into what they did wrong? How do I write my render method in
> > my controller to show all of the appropriate error messages? And more
> > important, what will my xml builder view look?
> >
>
> I tend to use the "merge errors" process gleaned from
> http://dev.rubyonrails.org/attachment/ticket/11394/merge_bang_errors.patch
>
> http://gist.github.com/376389
>
> Then in your controller you can use:
>
>  @foo.errors.merge! bar.errors
>
> ... and the view will work as normal, but with nice errors :-)
>
> --
> 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.
>
>

-- 
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: can i have a model called FILE.RB?

2010-04-23 Thread Frederick Cheung


On Apr 23, 2:43 pm, Marnen Laibow-Koser  wrote:
> Ar Chron wrote:
> > You can get by "reusing" a class name, but it's a PITA.
>
> > I had a model named Filter, then upgraded Rails at one point, and all
> > sorts of ugly conflicts occurred since the new version of Rails included
> > a Filter clas.
>
> > One solution is to reference the class to the local namespace, such as
> > in the controller:
>
> > @filters = ::Filter.find(blah blah blah)
>
> I believe that would be the global namespace, no?
>


That works because ActionController creates ActionController::Filter,
but ruby's File class is also at the top level so I don't think you'd
have much luck there

Fred
>
>
> > While it can be done, I wouldn't ever do it again.
>
> Yeah.
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> mar...@marnen.org
> --
> Posted viahttp://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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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.



Re: [Rails] Re: Ubuntu Linux Editor / Prettiefier

2010-04-23 Thread Greg Donald
On Fri, Apr 23, 2010 at 7:17 AM, Marnen Laibow-Koser
 wrote:
> Ah, good point.  Emacs is my favorite console editor, but I'm not all
> that crazy about the graphical versions I've tried.

But it's just so beautiful!

http://static.destiney.com/emacs_screen_shot.jpg

:)


-- 
Greg Donald
destiney.com | gregdonald.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.



Re: [Rails] Re: Ubuntu Linux Editor / Prettiefier

2010-04-23 Thread Greg Donald
On Fri, Apr 23, 2010 at 1:50 AM, tonypm  wrote:
> the thing I
> feel that is slowing me down at the moment is switching between
> buffers when working with multiple source files.

I switch buffers using the arrow keys most of the time.

Ctrl + x, and then left or right arrow.


-- 
Greg Donald
destiney.com | gregdonald.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.



Re: [Rails] Re: Ubuntu Linux Editor / Prettiefier

2010-04-23 Thread Greg Donald
On Fri, Apr 23, 2010 at 1:50 AM, tonypm  wrote:
> I havn't yet found a quick way to duplicate a line or series of lines
> eg alt+ctl+down arrow in netbeans - if anyone can enlighen me I would
> be grateful.

1) Move the cursor to the start of the text you want to select.
2) Set a starting mark using Ctrl + Space.
3) Move the cursor to the end of the text you want to select.
4) Copy the text using Alt + w, or cut the text using Ctrl + w.
5) Move the cursor to wherever.
6) Ctrl + y to paste.

Welcome to Emacs.  I couldn't imagine using something else at this point.


-- 
Greg Donald
destiney.com | gregdonald.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: can i have a model called FILE.RB?

2010-04-23 Thread Marnen Laibow-Koser
Ar Chron wrote:
> You can get by "reusing" a class name, but it's a PITA.
> 
> I had a model named Filter, then upgraded Rails at one point, and all 
> sorts of ugly conflicts occurred since the new version of Rails included 
> a Filter clas.
> 
> One solution is to reference the class to the local namespace, such as 
> in the controller:
> 
> @filters = ::Filter.find(blah blah blah)

I believe that would be the global namespace, no?

> 
> While it can be done, I wouldn't ever do it again.

Yeah.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
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: can i have a model called FILE.RB?

2010-04-23 Thread Ar Chron
You can get by "reusing" a class name, but it's a PITA.

I had a model named Filter, then upgraded Rails at one point, and all 
sorts of ugly conflicts occurred since the new version of Rails included 
a Filter clas.

One solution is to reference the class to the local namespace, such as 
in the controller:

@filters = ::Filter.find(blah blah blah)

While it can be done, I wouldn't ever do it again.
-- 
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: How to: Set a datetime params-value to nil in the controller

2010-04-23 Thread Tom Ha
Thanks for the explanations - they helped!
-- 
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: Rails internals ?.

2010-04-23 Thread Ar Chron
Dani Dani wrote:
> Thanky you both Marnen & Anubhaw.
> 
> I did run the depot example application and even used debugger to see 
> things from "inside", but still felt like someone who types in what he 
> was told. The feeling is still there, if I had to do it myself, there 
> are things I wouldN't know even they exist if they were not mentioned in 
> the book. That is what I ment when I ask - where is the collection of 
> all the methodes, helpers, ... of rails. I'll go to those sites you both 
> have mentioned. I'm sure I'll come with further questions.
> I do apprciate your quick answer and your motivation to help. Thank you 
> !.
> Dani.

So start your own project. On something you already know, so your not 
focused on "what data do I need", or "who are the users", or "how is the 
data organized" - you know, all those domain knowledge questions that 
are usually the most important things, and can instead focus on "how do 
I do this in Rails".

One of the most useful things I did early on was to scaffold a 
rudimentary application for a person's information, then read through 
and look at all the scaffolded routines, etc to see how rails wants to 
work.

rails myapp -d mysql
ruby script/generate scaffold person first_name:string last_name:string 
age:integer

Then go peruse the generated files and 'grok' how the Rails framework 
works.

Many books dive in with an application that fits how that author builds 
rails apps. Sure, one would suppose that an author is an authority on a 
subject, but read 5 Rails books and you'll get 5 different perspectives 
on how to build an app, how to define your views, etc, etc.

I wouldn't use a scaffolded application for a releasable product, but as 
an instructional tool, it's virtually free.
-- 
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: Rails internals ?.

2010-04-23 Thread Dani Dani
Thanky you both Marnen & Anubhaw.

I did run the depot example application and even used debugger to see 
things from "inside", but still felt like someone who types in what he 
was told. The feeling is still there, if I had to do it myself, there 
are things I wouldN't know even they exist if they were not mentioned in 
the book. That is what I ment when I ask - where is the collection of 
all the methodes, helpers, ... of rails. I'll go to those sites you both 
have mentioned. I'm sure I'll come with further questions.
I do apprciate your quick answer and your motivation to help. Thank you 
!.
Dani.
-- 
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] Logging in Production on Network Solutions

2010-04-23 Thread jrq
Network Solutions is really beginning to try my patience.   Can anyone
help me with get logs to work in a Production environment hosted on
Network Solutions?

I've edited envionment.rb to include "config.log_level = :debug",
restarted the app. but I still get nothing in the log directory.

-- 
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: slow tests on large rails app

2010-04-23 Thread Marnen Laibow-Koser
Myron Marston wrote:
>> Factory's are nice but they make your tests very slow.
> 
> This has been my experience, too.  

Though not mine as far as I can tell.  Which factory library are you 
using?  I use Machinist.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
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: AR create_or_update_if_needed rant -- must be a better w

2010-04-23 Thread Marnen Laibow-Koser
Fearless Fool wrote:
> I'll preface this by saying I (still) consider myself a relative
> newcomer to Rails, and its likely that I'm missing something obvious in
> ActiveRecords, but this has been bugging me...
> 
> I've written a function that I use all the time, but I get a nagging
> feeling that this functionality MUST already exist, and even if it
> doesn't, there's a better way than I'm doing it.  Anyway, thus:
> 
>   ActiveRecord.create_or_update_if_needed(attrs_to_match,
> attrs_to_update)
> 
> which lets me do things like:
> 
>   Address.create_or_update_if_needed({:street=>"1600 Pennsylvania
> Avenue, NW", :state=>"DC"}, {:zip=>"20500"})
> 
> If no records match on attrs_to_match then create one with those
> attributes AND with attrs_to_update.  If a record does exist but doesn't
> match the given attrs_to_update, then update only those attributes.
> Otherwise, leave the record alone - no change needed.
> 
> If there's an obvious way to do this, you can stop reading here and
> simply give me the recipe!! :)

Well, update_all with the :conditions option will get you most of the 
way there.  And what do you want to have happen if more than one record 
matches the conditions?

> 
> Still reading?  Really?  Okay, here's how I've defined it:
> =
> class ActiveRecord::Base
> 
>   def self.create_or_update_if_needed(attrs_to_match, attrs_to_update)
> record = find(:first, :conditions=>attrs_to_match)
> if (record.nil?)

Lose the parentheses -- if isn't a function.

>   record = create(attrs_to_match.merge(attrs_to_update))
> elsif (!record.attributes_match?(attrs_to_update))
>   record.update_attributes(attrs_to_update)
> end
> record
>   end
> 
>   def attributes_match?(attrs)
> # use new() to convert attribute keys and values
> mangled_attrs = self.class.new(attrs).attributes
> mangled_attrs.all? {|k,v| v.nil? || self.attributes[k] == v }
>   end
> 
> end
> =
> Note that the "obvious" definition of attributes_match? would NOT work:
> 
>   def attributes_match?(attrs)
> attrs.all? {|k,v| self.attributes[k] == v}
>   end
> 
> ... because self.attributes use strings as hash keys, not symbols, and
> attribute values may be subject to type conversions.  

Then try HashWithIndifferentAccess or stringify_keys.  You're 
overcomplicating this.

> So I create a new
> record, using the given attrs, and let the ActiveRecord mechanism handle
> the conversions.
> 
> But by the time I've gone to this level of hackery, it seems prudent to
> harness the wisdom of the masses: is there a better way?
> 

Yes!  Work *with* the framework instead of around it, as I suggested 
above.

> - ff

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
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: Rails internals ?.

2010-04-23 Thread Marnen Laibow-Koser
Dani Dani wrote:
> Hi. I'm new to ROR, I bought the book "Agile Web Development with Rails,
> Third Edition" and followed the depot example. I still can't imagine me
> developing a rails application after that.

Have you tried?  Sometimes you just have to take the plunge in order to 
learn something.

> There are many things that
> are not explained, and many things that are mentioned, e.g. Rails
> methods, helpers, ..., which I don't know where to find them if I was
> looking for them. 

If you ask questions, perhaps we can help.

> Where can I find something like "Rails Internals", as
> I assume that not everything that Rails can do was mentioned in that
> book. I'm looking for something that covers everything that rails
> offers, where I can look for things that can help developing Rails
> applications.

Then you're probably not looking for Rails internals at this stage. 
Just look through the Rails guides and the API docs 
(http://www.railsapi.com presents the docs more readably than the 
official site).

> I would like to develope a web application to manage
> different language courses, participants, trainers, invoicing ... This
> should then be used by one or more separate language companies.
> 

Do it, then!  Start with what you can figure out, and do research and 
ask questions as necessary.  Do all development test-first.

> I hope my query is clear. Thanks for any answer.
> Dani.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
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.



Re: [Rails] Re: Ubuntu Linux Editor / Prettiefier

2010-04-23 Thread Dhruva Sagar
I support VIM / GVIM all the way

Thanks & Regards,
Dhruva Sagar.



On Fri, Apr 23, 2010 at 17:47, Marnen Laibow-Koser wrote:

> tonypm wrote:
> > Interesting that no one hs yet mentioned emacs.
>
> Ah, good point.  Emacs is my favorite console editor, but I'm not all
> that crazy about the graphical versions I've tried.
>
> >  I decided the other
> > day to give it a go since so many posters had raved about it and
> > Netbeans sluggishness was frustrating me.
>
> NetBeans is an excellent IDE, but it's overkill for Rails.  (I'd be
> curious to know about it's sluggishness, though -- it has consistently
> been pretty fast for me on Snow Leopard.)
>
> [...]
> > Got the speedbar working for rails files - necessary for my transition
> > since I am finding grasping all the keyboard command sequences very
> > hard.
>
> Then I'd almost say you shouldn't use Emacs.  You definitely have to be
> comfortable with keyboard commands to get the most out of it.
>
> >
> > The biggest hurdle seems to be finding out exactly what can do with
> > it.
>
> Often, yes.
>
> >  Syntax highlighting is great
>
> Any better than in other editors?
>
> > and being able to directly open
> > views from being in a controller action etc is great,
>
> This is one thing I miss in Komodo.  Aptana has this.
>
> > but all the
> > other stuff seems a million miles away.
> >
> > Although I am finding it difficult I intend to persevere, the thing I
> > feel that is slowing me down at the moment is switching between
> > buffers when working with multiple source files.
>
> You might want to investigate a GUI version of Emacs, then.  I don't
> like the ones I've tried, but you might.
>
> >
> > I have never done much with auto completion or snippets even with
> > Netbeans, but suspect that there is performance gain just waiting to
> > be harvested.  I am envious when I watch Ryan Bates editing code he
> > zips around so elegantly (I know that is Textmate but emacs is
> > supposed to come close to it)
>
> IMHO, so does KomodoEdit.  Actually, Emacs "coming close to [TextMate]"
> is a funny statement: Emacs is probably the more powerful of the two.
>
> >
> > There are some screencasts around for emacs and rails, but they have
> > no sound and the casters seem to forget that they are dealing with
> > novices and screens flash around with invsible keystrokes in a way
> > that makes my head hurt.  Nevertheless they do give an overview of
> > what is possible.
> >
> > I havn't yet found a quick way to duplicate a line or series of lines
> > eg alt+ctl+down arrow in netbeans - if anyone can enlighen me I would
> > be grateful.
>
> C-k, C-y, C-y.  There may be a faster way.  If you don't know this, you
> *really* need to spend time on Emacs basics.
>
> >
> > Tonypm
>
> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> mar...@marnen.org
> --
> 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.
>
>

-- 
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: Ubuntu Linux Editor / Prettiefier

2010-04-23 Thread Marnen Laibow-Koser
tonypm wrote:
> Interesting that no one hs yet mentioned emacs.

Ah, good point.  Emacs is my favorite console editor, but I'm not all 
that crazy about the graphical versions I've tried.

>  I decided the other
> day to give it a go since so many posters had raved about it and
> Netbeans sluggishness was frustrating me.

NetBeans is an excellent IDE, but it's overkill for Rails.  (I'd be 
curious to know about it's sluggishness, though -- it has consistently 
been pretty fast for me on Snow Leopard.)

[...]
> Got the speedbar working for rails files - necessary for my transition
> since I am finding grasping all the keyboard command sequences very
> hard.

Then I'd almost say you shouldn't use Emacs.  You definitely have to be 
comfortable with keyboard commands to get the most out of it.

> 
> The biggest hurdle seems to be finding out exactly what can do with
> it.

Often, yes.

>  Syntax highlighting is great

Any better than in other editors?

> and being able to directly open
> views from being in a controller action etc is great, 

This is one thing I miss in Komodo.  Aptana has this.

> but all the
> other stuff seems a million miles away.
> 
> Although I am finding it difficult I intend to persevere, the thing I
> feel that is slowing me down at the moment is switching between
> buffers when working with multiple source files.

You might want to investigate a GUI version of Emacs, then.  I don't 
like the ones I've tried, but you might.

> 
> I have never done much with auto completion or snippets even with
> Netbeans, but suspect that there is performance gain just waiting to
> be harvested.  I am envious when I watch Ryan Bates editing code he
> zips around so elegantly (I know that is Textmate but emacs is
> supposed to come close to it)

IMHO, so does KomodoEdit.  Actually, Emacs "coming close to [TextMate]" 
is a funny statement: Emacs is probably the more powerful of the two.

> 
> There are some screencasts around for emacs and rails, but they have
> no sound and the casters seem to forget that they are dealing with
> novices and screens flash around with invsible keystrokes in a way
> that makes my head hurt.  Nevertheless they do give an overview of
> what is possible.
> 
> I havn't yet found a quick way to duplicate a line or series of lines
> eg alt+ctl+down arrow in netbeans - if anyone can enlighen me I would
> be grateful.

C-k, C-y, C-y.  There may be a faster way.  If you don't know this, you 
*really* need to spend time on Emacs basics.

> 
> Tonypm

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
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: Rails internals ?.

2010-04-23 Thread Anubhaw Prakash
Dani Dani wrote:
> Hi. I'm new to ROR, I bought the book "Agile Web Development with Rails,
> Third Edition" and followed the depot example. I still can't imagine me
> developing a rails application after that. There are many things that
> are not explained, and many things that are mentioned, e.g. Rails
> methods, helpers, ..., which I don't know where to find them if I was
> looking for them. Where can I find something like "Rails Internals", as
> I assume that not everything that Rails can do was mentioned in that
> book. I'm looking for something that covers everything that rails
> offers, where I can look for things that can help developing Rails
> applications. I would like to develope a web application to manage
> different language courses, participants, trainers, invoicing ... This
> should then be used by one or more separate language companies.
> 
> I hope my query is clear. Thanks for any answer.
> Dani.

Hi Dani,
Take a look at rails guide 'http://guides.rubyonrails.org/'. This would 
help you to get started in rails.

-- 
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] Rails internals ?.

2010-04-23 Thread Dani Dani
Hi. I'm new to ROR, I bought the book "Agile Web Development with Rails,
Third Edition" and followed the depot example. I still can't imagine me
developing a rails application after that. There are many things that
are not explained, and many things that are mentioned, e.g. Rails
methods, helpers, ..., which I don't know where to find them if I was
looking for them. Where can I find something like "Rails Internals", as
I assume that not everything that Rails can do was mentioned in that
book. I'm looking for something that covers everything that rails
offers, where I can look for things that can help developing Rails
applications. I would like to develope a web application to manage
different language courses, participants, trainers, invoicing ... This
should then be used by one or more separate language companies.

I hope my query is clear. Thanks for any answer.
Dani.
-- 
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.



Re: [Rails] how to display error messages for a child resource that failed validation

2010-04-23 Thread Michael Pavling
On 23 April 2010 01:23, Matthew Hillsborough
 wrote:
> That is what I can't figure out. Why am I getting Bars is invalid
> versus the error messages displayed above, ["Real can't be blank",
> "Real you must supply a valid email"]  etc.
>
> How do I have this output the real error messages so the user has some
> insight into what they did wrong? How do I write my render method in
> my controller to show all of the appropriate error messages? And more
> important, what will my xml builder view look?
>

I tend to use the "merge errors" process gleaned from
http://dev.rubyonrails.org/attachment/ticket/11394/merge_bang_errors.patch

http://gist.github.com/376389

Then in your controller you can use:

  @foo.errors.merge! bar.errors

... and the view will work as normal, but with nice errors :-)

-- 
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.



Re: [Rails] Re: Mocking, a common practice

2010-04-23 Thread Franz Strebel
Check out flexmock as well

http://flexmock.rubyforge.org/

On Fri, Apr 23, 2010 at 11:09 AM, Frederick Cheung
 wrote:
>
>
> On Apr 23, 8:33 am, mariek  wrote:
>
>> And the reason why I need to do it this way is because in some
>> particular tests I need to mock the class method and in other i don't.
>> In my case it is about calls to sandbox. In some tests I check if they
>> are made correctly and in other I test only logic flow and I don't
>> want to make real calls to sandbox.
>>
>> Thanks for any ideas.
>>
>
> use something like mocha, rr or the mocking in rspec ?
>
> Fred
>> --
>> 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 
>> athttp://groups.google.com/group/rubyonrails-talk?hl=en.
>
> --
> 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.
>
>

-- 
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: Blog ruby on rails/Django Fastes made

2010-04-23 Thread Fernando Perez
Bob 101155 wrote:
> Hi I've got a little quetion.
> For school I've to make a blog either using ruby on rails or Django.
> I've to do this at home, install the languages, etc.
> I've to make screenshots while running the language and blog.
> tell why I chose that language and the files i made for the blog.
> 
> What would be the fastes way to do this??
> 
> Thanks a lot already

I run suivauto.com which is written using RoR, and this week it took me 
3 days to add a blog with an xmlrpc interface (that alone took more than 
a day) for posting via MarsEdit.

I do not know about django, and would be glad to read your report if you 
do end up using it.
-- 
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: Mocking, a common practice

2010-04-23 Thread Frederick Cheung


On Apr 23, 8:33 am, mariek  wrote:

> And the reason why I need to do it this way is because in some
> particular tests I need to mock the class method and in other i don't.
> In my case it is about calls to sandbox. In some tests I check if they
> are made correctly and in other I test only logic flow and I don't
> want to make real calls to sandbox.
>
> Thanks for any ideas.
>

use something like mocha, rr or the mocking in rspec ?

Fred
> --
> 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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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: script/server not working, I can't setup my local environment.

2010-04-23 Thread Frederick Cheung


On Apr 23, 5:12 am, Matt  wrote:
> Hey guys,
>
> I've been trying to get my local env up and running on my new machine,
> I never really figured out how I did it last time, and this time its a
> nightmare. Every time I go to run script/server in my project file, I
> get this error below which asks about certain gems being required but
> I guarantee they are installed. I just don't know what to do anymore,
> I am more a designer than anything else, can someone please help me
> figure out whats up?
>

do you have both oauth_client & vimeo ?

Fred
> => Booting WEBrick
> => Rails 2.3.5 application starting 
> onhttp://0.0.0.0:3000/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/...
> gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is
> deprecated and will be removed on or after August 2010.  Use
> #requirement
> no such file to load -- oauth_client
> /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
> /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `require'
> /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:156:in `require'
> /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:521:in `new_constants_in'
> /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:156:in `require'
> /Users/Matt/.gem/ruby/1.8/gems/vimeo-1.1.0/lib/vimeo.rb:6
> /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
> /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `require'
> /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:156:in `require'
> /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:521:in `new_constants_in'
> /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:156:in `require'
> /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/
> gem_dependency.rb:208:in `load'
> /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> 307:in `load_gems'
> /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> 307:in `each'
> /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> 307:in `load_gems'
> /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> 164:in `process'
> /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> 113:in `send'
> /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> 113:in `run'
> /Users/Matt/Sites/statlr/config/environment.rb:9
> /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
> /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `require'
> /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:156:in `require'
> /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:521:in `new_constants_in'
> /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:156:in `require'
> /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:
> 84
> /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
> /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `require'
> script/server:3
> no such file to load -- oauth_client
> /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
> /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `require'
> /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:156:in `require'
> /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:521:in `new_constants_in'
> /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:156:in `require'
> /Users/Matt/.gem/ruby/1.8/gems/vimeo-1.1.0/lib/vimeo.rb:6
> /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
> /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `require'
> /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:156:in `require'
> /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:521:in `new_constants_in'
> /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:156:in `require'
> /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/
> gem_dependency.rb:208:in `load'
> /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> 307:in `load_gems'
> /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> 307:in `each'
> /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> 307:in `load_gems'
> /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> 169:in `process'
> /

[Rails] Re: Passing variables

2010-04-23 Thread Hemant Bhargava
Sharagoz wrote:
> This is Prototype, not Rails, which is probably the reason for the
> lack of responses.
> The API is here:
> http://www.prototypejs.org/api/ajax/options
> 
> My guess is that you need to replace the comma with a plus operator
> and prepend the second parameter with a &
> 
> new Ajax.Request('/controller/action?id=" + value + "&status=JOINING',
> {asynchronous:true, evalScripts:true, parameters:'resume[comment]=' +
> $F('resume_comment" + forward_value + "') + '&joining_date=' +
> $F('joining_date" + forward_value + "')}); return false;");

Ohh.. yeah yeah.. you are correct.. That was the thing i was missing..
Thanks with a big smile.. :)

-- 
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: What is the difference between new and build?

2010-04-23 Thread Sharagoz
In the first one, the child is saved right away.
In the second, the child is not saved until the parent is saved

You may find this usefull:
http://blog.mrbrdo.net/2009/10/27/ruby-on-rails-new-vs-create-vs-build/

On Apr 23, 9:38 am, Manoj Kumar  wrote:
> What is the difference between
>
> parent.children << child.new
>
> and
>
> parent.children.build(params[:child])
> --
> Posted viahttp://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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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: Passing variables

2010-04-23 Thread Sharagoz
This is Prototype, not Rails, which is probably the reason for the
lack of responses.
The API is here:
http://www.prototypejs.org/api/ajax/options

My guess is that you need to replace the comma with a plus operator
and prepend the second parameter with a &

new Ajax.Request('/controller/action?id=" + value + "&status=JOINING',
{asynchronous:true, evalScripts:true, parameters:'resume[comment]=' +
$F('resume_comment" + forward_value + "') + '&joining_date=' +
$F('joining_date" + forward_value + "')}); return false;");


On Apr 23, 9:15 am, Hemant Bhargava  wrote:
> Hemant Bhargava wrote:
> > Hello all,
> > But now both of the variables are not passing.. Can you guys give me
> > some light that what i am missing here .. ?
>
> Anyone listening me.. :)
>
> --
> Posted viahttp://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 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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] Blog ruby on rails/Django Fastes made

2010-04-23 Thread Bob 101155
Hi I've got a little quetion.
For school I've to make a blog either using ruby on rails or Django.
I've to do this at home, install the languages, etc.
I've to make screenshots while running the language and blog.
tell why I chose that language and the files i made for the blog.

What would be the fastes way to do this??

Thanks a lot already
-- 
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] What is the difference between new and build?

2010-04-23 Thread Manoj Kumar
What is the difference between

parent.children << child.new

and

parent.children.build(params[:child])
-- 
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] Mocking, a common practice

2010-04-23 Thread mariek
I would like to ask for Your experience how to handle mocking class
method only for one specific test.

Scenario is:
I have unit test suite and in one of the test I have mocked a class
method, and I want this class method to be only mocked in this
specific test.
But this mock applies to all test files while I run rake test:units.

I thought about doing like this with setup and teardown:

class SomeTest < ...

def setup
  #here ovveride class method body in runtime
end

def teardown
  #and here bring back class method body in runtime
end

end

But I'm not sure if this is the way it should be done ?

And the reason why I need to do it this way is because in some
particular tests I need to mock the class method and in other i don't.
In my case it is about calls to sandbox. In some tests I check if they
are made correctly and in other I test only logic flow and I don't
want to make real calls to sandbox.

Thanks for any ideas.

-- 
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] script/server not working, I can't setup my local environment.

2010-04-23 Thread Matt
Hey guys,

I've been trying to get my local env up and running on my new machine,
I never really figured out how I did it last time, and this time its a
nightmare. Every time I go to run script/server in my project file, I
get this error below which asks about certain gems being required but
I guarantee they are installed. I just don't know what to do anymore,
I am more a designer than anything else, can someone please help me
figure out whats up?

=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/
gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is
deprecated and will be removed on or after August 2010.  Use
#requirement
no such file to load -- oauth_client
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:156:in `require'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:521:in `new_constants_in'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:156:in `require'
/Users/Matt/.gem/ruby/1.8/gems/vimeo-1.1.0/lib/vimeo.rb:6
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:156:in `require'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:521:in `new_constants_in'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:156:in `require'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/
gem_dependency.rb:208:in `load'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
307:in `load_gems'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
307:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
307:in `load_gems'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
164:in `process'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
113:in `send'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
113:in `run'
/Users/Matt/Sites/statlr/config/environment.rb:9
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:156:in `require'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:521:in `new_constants_in'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:156:in `require'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:
84
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
script/server:3
no such file to load -- oauth_client
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:156:in `require'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:521:in `new_constants_in'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:156:in `require'
/Users/Matt/.gem/ruby/1.8/gems/vimeo-1.1.0/lib/vimeo.rb:6
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:156:in `require'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:521:in `new_constants_in'
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:156:in `require'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/
gem_dependency.rb:208:in `load'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
307:in `load_gems'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
307:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
307:in `load_gems'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
169:in `process'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
113:in `send'
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
113:in `run'
/Users/Matt/Sites/statlr/config/environment.rb:9
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_ori

[Rails] how to display error messages for a child resource that failed validation

2010-04-23 Thread Matthew Hillsborough
Can anyone explain why this happens?

mybox:$ ruby script/console
Loading development environment (Rails 2.3.5)
>> foo = Foo.new
=> #
>> bar = Bar.new
=> #
>> bar.save
=> false
>> bar.errors.each_full { |msg| puts msg }
Real can't be blank
Real You must supply a valid email
=> ["Real can't be blank", "Real You must supply a valid email"]

So far that is perfect, that is what i want the error message to read.
Now for more:

>> foo.bars << bar
=> [#]
>> foo.save
=> false
>> foo.errors.to_xml
=> "\n\n
Bars is invalid\n\n"

That is what I can't figure out. Why am I getting Bars is invalid
versus the error messages displayed above, ["Real can't be blank",
"Real you must supply a valid email"]  etc.

My controller simply has a respond_to method with the following in it:

 format.xml  { render :xml => @foo.errors, :status
=> :unprocessable_entity }

How do I have this output the real error messages so the user has some
insight into what they did wrong? How do I write my render method in
my controller to show all of the appropriate error messages? And more
important, what will my xml builder view look?

-- 
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] Socket app on shared environment?

2010-04-23 Thread poolbastard
Hi group, I'm just wondering if anyone has any experienced having a
custom socket app, unique port, etc on a shared environment; I'm sort
of convinced I would need at least a VPS, but asking just in case some
knows of an alternative solution or workaround.

Best regards,

-- 
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] ruby Job in San Francisco

2010-04-23 Thread echeyde
hi, I am looking for some awesome ruby developers in San Francisco for
singlefeed.
Please see my posting at  http://bit.ly/9C9hVP
Thanks
Echeyde

-- 
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: Best practice around putting rails database info int

2010-04-23 Thread Frederick Cheung


On Apr 22, 9:55 pm, Rob Biedenharn 
wrote:
> On Apr 22, 2010, at 4:23 PM, Frederick Cheung wrote:
>
> > I think there is a difference between an app like mephisto or similar
> > where many people are going to be deploying instances all over the
> > place and a private app for which there is only ever going to be one
> > deploy. With the latter, the database is the definition of the schema
> > and you don't care about people deploying the app from scratch because
> > no one will
>
> > Fred
>
> "only ever going to be one deploy" ??
>
> When does the app work right the very first time and never has to be  
> changed?

Sorry that wasn't very clear. a better phrasing might be "only one
deployment" (which you of course keep working on and updating as
needed)

Fred

-- 
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: Passing variables

2010-04-23 Thread Hemant Bhargava
Hemant Bhargava wrote:
> Hello all,

> But now both of the variables are not passing.. Can you guys give me
> some light that what i am missing here .. ?

Anyone listening me.. :)

-- 
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: Caching of data on server?

2010-04-23 Thread Pieter Hugo
Hi Guys

Thanks for the help - and the warning. I got the global variable thing 
working - in principle - but now rails complains that I cannot do 
something like

$rights = Rights.find(:all)

in environment.rb

I'm giving it up for a bad job - (not that I need to squeeze the last 
drop of performance out of the system yet) I think I'll stick to reading 
from the db every time as you suggest. (There is probably already 
caching of the table going on in the background in any case)

I take the point that global variables are not stable enough, but it 
still strikes me as wasteful having to constantly access a small table 
which I know is not changing - millions of times more disk access and 
processor cycles than just reading it when the web server starts up and 
tagging it along in memory.

But then - I am the first to admit that I am not really qualified to be 
making these statements ;)

Thanks again for the assistance. You guys are great!

Pieter
-- 
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: App to Pick up application release from Git/Capistrano?

2010-04-23 Thread Owain
Thanks Peter and Rob.

I think it would still make sense to do this during initialization
rather than at the application controller since it is during
initialization is then it will change.  I will also add some logic to
the view just to check REVISION is there, perhaps in future the app
might not be deployed using Cap.  Sounds like a little helper.

O.

-- 
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.