Re: [Rails] Re: Allow blank on should validate_uniqueness_of

2010-06-16 Thread J . Pablo Fernández
Where do you pass that?

should validate_uniqueness_of(:email, :allow_blank => true)

That doesn't work. That method takes only one argument:

/Users/pupeno/.rvm/gems/ruby-1.8.7-p...@lemonfrog/gems/shoulda-2.11.0/lib/shoulda/context.rb:429:in
`validate_uniqueness_of': wrong number of arguments (2 for 1)
(ArgumentError)
from 
/Users/pupeno/.rvm/gems/ruby-1.8.7-p...@lemonfrog/gems/shoulda-2.11.0/lib/shoulda/context.rb:429:in
`send'
from 
/Users/pupeno/.rvm/gems/ruby-1.8.7-p...@lemonfrog/gems/shoulda-2.11.0/lib/shoulda/context.rb:429:in
`method_missing'
from ./test/unit/meta_data_test.rb:14:in `__bind_1276752425_894930'
from 
/Users/pupeno/.rvm/gems/ruby-1.8.7-p...@lemonfrog/gems/shoulda-2.11.0/lib/shoulda/context.rb:306:in
`call'
from 
/Users/pupeno/.rvm/gems/ruby-1.8.7-p...@lemonfrog/gems/shoulda-2.11.0/lib/shoulda/context.rb:306:in
`merge_block'
from 
/Users/pupeno/.rvm/gems/ruby-1.8.7-p...@lemonfrog/gems/shoulda-2.11.0/lib/shoulda/context.rb:301:in
`initialize'
from 
/Users/pupeno/.rvm/gems/ruby-1.8.7-p...@lemonfrog/gems/shoulda-2.11.0/lib/shoulda/context.rb:199:in
`new'
from 
/Users/pupeno/.rvm/gems/ruby-1.8.7-p...@lemonfrog/gems/shoulda-2.11.0/lib/shoulda/context.rb:199:in
`context'
from ./test/unit/meta_data_test.rb:8
from 
/Users/pupeno/.rvm/gems/ruby-1.8.7-p...@lemonfrog/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:147:in
`load_without_new_constant_marking'
from 
/Users/pupeno/.rvm/gems/ruby-1.8.7-p...@lemonfrog/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:147:in
`load'
from 
/Users/pupeno/.rvm/gems/ruby-1.8.7-p...@lemonfrog/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
from 
/Users/pupeno/.rvm/gems/ruby-1.8.7-p...@lemonfrog/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in
`each'
from 
/Users/pupeno/.rvm/gems/ruby-1.8.7-p...@lemonfrog/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5

On Tue, Jun 15, 2010 at 22:46, chewmanfoo  wrote:
> :allow_blank => true
>
> On Jun 15, 3:26 pm, J. Pablo Fernández  wrote:
>> Hello,
>>
>> Using shoulda, any ideas how to allow blank when having this test:
>>
>> should validate_uniqueness_of(:email)
>>
>> Thanks.
>> --
>> J. Pablo Fernández  (http://pupeno.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.
>
>



-- 
J. Pablo Fernández  (http://pupeno.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: mysql gem install not happening on Mac OS Leopard - any inputs at all??

2010-06-16 Thread Ram
Im not re-installing the mysql gem. I have been using the Ruby based
mysql library that used to ship with Rails by default (pre 2.2). If I
am to migrate to Rails 2.3 then I HAVE to install the gem now.

On Jun 16, 8:58 pm, Hassan Schroeder 
wrote:
> On Tue, Jun 15, 2010 at 1:41 AM, Ram  wrote:
> > Ive got Mac OS XLeopard(10.5.8), ruby 1.8.6 (2009-06-08 patchlevel
> > 369) [universal-darwin9.0] andmysql5.0.67 installed and working fine
> > with Rails 2.1.0.
> > Im trying to upgrade my Rails apps to 2.3.5 but when i try to install
> > themysqlgem
>
> If it was "working fine with Rails 2.1.0" and you're just upgrading Rails
> itself, why are you trying to (re-)install themysqlgem?
>
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
> twitter: @hassan

-- 
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 won't execute backticked OS commands

2010-06-16 Thread Greg Willits
I'm at a loss as what to look for...

I can issue a command result = `some_os_command_string` on my dev system
just fine in both a pur ruby test file, and from Rails in dev mode.

When I push that code to my server, the backtick command doesn't work.
No failure message -- even if I wrap it in begin/rescue so I have no
specific clues to work from.

I can run that same back ticked command on the server from a simple ruby
test file, but not from Rails.

Any ideas what I could look for as to why Rails might be interfering
with this?

Thx

(OS X 10.5.8 client and server versions, Ruby 1.8.6, Rails 2.3.2)

-- gw
-- 
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: Multiple classes on form text_field

2010-06-16 Thread Saurabh Peshkar
Hi Ralph,

Have you tried this:

<%= f.text_field :x, :class => 's t' %>

Regards,

Saurabh
-- 
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] Beta 4 and Modularized::Controllers

2010-06-16 Thread Yuri
Seems that in beta 4 and master, a route defined in a namespace :foo,
or with controller: 'foo/bar', or with scope module: 'foo' always nets
one: 'wrong constant name Foo/barController'. Did the ways of setting
up routes to controllers in modules change? Or is it perhaps a problem
with b4 v. 1.9.2 (we were running these routes on 1.9.1 up to b4.)

-- 
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] tabular view gem in script/console

2010-06-16 Thread Chamnap
I remember there is a gem on github that is able to display tabular
view like mysql console in script/console. Anyone knows, I seem to
forget, couldn't find it?


Thanks
Chamnap

-- 
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] Multiple classes on form text_field

2010-06-16 Thread Ralph Shnelvar
Consider :

- - - -

<% form_for(@z) do |f| %>
  <%= f.error_messages %>
  
<%= f.label :x %>
<%= f.text_field :x, :class => 's' %>
  
  
<%= f.submit 'Update' %>
  
<% end %>

- - - -

The above form works fine.  What I want to do is have two classes, s and
t, associated with text_field :x.

The following does not work.

- - - -

<% form_for(@z) do |f| %>
  <%= f.error_messages %>
  
<%= f.label :x %>
<%= f.text_field :x, :class => {'s', 't'} %>
  
  
<%= f.submit 'Update' %>
  
<% end %>

- - - -

The code above will generate a single class class="st"

How can I have two classes in the same field using form helper?  Do I
have to generate my own html?
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To 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: passenger and apache mpm's

2010-06-16 Thread Hongli Lai
On Jun 17, 12:47 am, Bruno Sousa  wrote:
> Hi!
> Is it safe to run phusion passenger with all apache kinds of MPM?

Prefork and Worker are supported.

-- 
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] passenger and apache mpm's

2010-06-16 Thread Bruno Sousa
Hi!
Is it safe to run phusion passenger with all apache kinds of MPM?

regards
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



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

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

In other words, you have a hierarchical tree of circuits.

> 
>   has_and_belongs_to_many :subcircuits,
> :class_name => "Circuit",
> :join_table => "circuit_glue",
> :association_foreign_key => "PTR_component",
> :foreign_key => "PTR_circuit"
>   has_and_belongs_to_many :supercircuits,
> :class_name => "Circuit",
> :join_table => "circuit_glue",
> :foreign_key => "PTR_component",
> :association_foreign_key => "PTR_circuit"
> 
> With this, I can do successfully things like
> my_circuit.subcircuits[0].name
> but if I try
> my_circuit.subcircuits[0].subcircuits.any_method
> ... I get a NoMethodError: You have a nil object when you didn't expect
> it!
> The objects in the cct.subciruits array do not appear to 'full' circuit
> objects in as much as they do not repsonsd to 'subcircuits'
> To build a recursive list of subcircuits I find I have to resort to
> 
> self.subcircuits.each { |sc|
> subcirc_array.push(Circuit.find(:all).detect { |c| c.absid.to_s ==
> sc.PTR_component })}
> ... which seems pretty slow and laborious.  Any advice on how to speed
> this up, and/or get ...subciruits[n].subcircuits to work as required?
> Thanks in advance.

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

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] Recursive self-referential many-to-many relationship

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

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

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

self.subcircuits.each { |sc|
subcirc_array.push(Circuit.find(:all).detect { |c| c.absid.to_s ==
sc.PTR_component })}
... which seems pretty slow and laborious.  Any advice on how to speed
this up, and/or get ...subciruits[n].subcircuits to work as required?
Thanks in advance.
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Forcing helper like link_to to use single quotes

2010-06-16 Thread Colin Law
On 16 June 2010 21:01, Greg Donald  wrote:
> On Wed, Jun 16, 2010 at 2:39 PM, Pale Horse  wrote:
>> If you want consistency, consistently use double quotations.
>
> Always using double quotes causes every string to be interpolated,
> often when not required.  Single quoted string are not interpolated,
> saving CPU cycles.  Computer science 101.

Looking at the original post it appears he is talking about
single/double quotes in the html, not in Ruby code.  Interpolation is
therefore not occurring.

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] Re: Calling to_yaml on an array of ActiveRecord objects is producing TypeError: wrong argument type

2010-06-16 Thread Stew Mckinney
I also run into the same error when running Spec tests that trigger 
Observers, which trigger DelayedJobs.

The full stack trace:

ruby-1.8.7-p249/lib/ruby/1.8/yaml.rb:391:in `emit'
ruby-1.8.7-p249/lib/ruby/1.8/yaml.rb:391:in `quick_emit'
ruby-1.8.7-p249/lib/ruby/1.8/yaml/rubytypes.rb:15:in `to_yaml'
vendor/bundler_gems/gems/delayed_job-2.0.3/lib/delayed/backend/base.rb:61:in 
`payload_object='
vendor/bundler_gems/gems/activerecord-2.3.5/lib/active_record/base.rb:2746:in 
`send'
vendor/bundler_gems/gems/activerecord-2.3.5/lib/active_record/base.rb:2746:in 
`attributes='
vendor/bundler_gems/gems/activerecord-2.3.5/lib/active_record/base.rb:2742:in 
`each'
vendor/bundler_gems/gems/activerecord-2.3.5/lib/active_record/base.rb:2742:in 
`attributes='
vendor/bundler_gems/gems/activerecord-2.3.5/lib/active_record/base.rb:2438:in 
`initialize'
vendor/bundler_gems/gems/activerecord-2.3.5/lib/active_record/base.rb:721:in 
`new'
vendor/bundler_gems/gems/activerecord-2.3.5/lib/active_record/base.rb:721:in 
`create'
vendor/bundler_gems/gems/delayed_job-2.0.3/lib/delayed/backend/base.rb:21:in 
`enqueue'
app/models/mail_opt_in_observer.rb:12:in `after_save'
app/models/mail_opt_in_observer.rb:11:in `each'
app/models/mail_opt_in_observer.rb:11:in `after_save'
vendor/plugins/state_machine/lib/state_machine/integrations/active_record/observer.rb:32:in
 
`send'
vendor/plugins/state_machine/lib/state_machine/integrations/active_record/observer.rb:32:in
 
`update'

I've been trying to find the root of this for a few days now and its 
getting a little frustrating. I've tried to re-open the class and do the 
following (because I noticed the error doesn't occur when I *clone* the 
object and then call to_yaml).

module ActiveRecord
  class Base

to_old_yaml = self.instance_method(:to_yaml)

define_method(:to_yaml) do
  clone = self.clone
 clone.id = self.id
  oh_boy = to_old_yaml.bind(clone).call
 #debugger
 #testtest = 'test'
  return oh_boy
end

  end
end

...but this yields a similar error:

wrong argument type String (expected Data)

> Scott wrote:
> I have a query I am running from the console that is eager loading the
> address on the people model:
> 
> people = People.find(:all,
>:include => [:address],
>:limit => 50)
> 
> Trying to output that to yaml via:
> 
> people.to_yaml
> 
> Produces the following exception:
> 
> TypeError: wrong argument type nil (expected Data)
>   from /usr/local/lib/ruby/1.8/yaml.rb:387:in `emit'
>   from /usr/local/lib/ruby/1.8/yaml.rb:387:in `quick_emit'
>   from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:107:in `to_yaml'
>   from (irb):10
> 
> I don't see any nil data in the include... thoughts?
> 
> Thanks,
> 
> Scott

-- 
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: Forcing helper like link_to to use single quotes

2010-06-16 Thread Greg Donald
On Wed, Jun 16, 2010 at 2:39 PM, Pale Horse  wrote:
> If you want consistency, consistently use double quotations.

Always using double quotes causes every string to be interpolated,
often when not required.  Single quoted string are not interpolated,
saving CPU cycles.  Computer science 101.


-- 
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: Forcing helper like link_to to use single quotes

2010-06-16 Thread Pale Horse
Marnen Laibow-Koser wrote:
> 
> That's not true.  The OP seems to be talking about the quotation marks 
> in the generate HTML, not in the Ruby source code.
> 
>
> 
> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> mar...@marnen.org

It would appear I've been misguided.
-- 
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: Forcing helper like link_to to use single quotes

2010-06-16 Thread Marnen Laibow-Koser
Pale Horse wrote:
> Sharkie Landshark wrote:
>>
>> For example, I want  rather than 
>> 
>> I want to maintain consistency with style.
>> 
>> Can this be done?
>> 
>> Also, I am trying to use Rails 3.0.
>> 
>> Sharkie
> 
> I would not recommend using single quotations over double. One argument 
> against using single quotes is that you will not be able to embed ruby 
> code into your link:
> 
> "A link to a #{link_to("website", "http://ruby-forum.com";)}"
>

That's not true.  The OP seems to be talking about the quotation marks 
in the generate HTML, not in the Ruby source code.

> If you want consistency, consistently use double quotations.

Better yet, don't worry about it.


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: Forcing helper like link_to to use single quotes

2010-06-16 Thread Pale Horse
Sharkie Landshark wrote:
>
> For example, I want  rather than 
> 
> I want to maintain consistency with style.
> 
> Can this be done?
> 
> Also, I am trying to use Rails 3.0.
> 
> Sharkie

I would not recommend using single quotations over double. One argument 
against using single quotes is that you will not be able to embed ruby 
code into your link:

"A link to a #{link_to("website", "http://ruby-forum.com";)}"

If you want consistency, consistently use double quotations.
-- 
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] :wrapper_tag, :wrapper_class options (and more) with simple_form and Rails 2.3 ?

2010-06-16 Thread Fro_oo
Hi,

I'm making my first Rails project and I'm using the simple_form gem
(version 1.0) with a Rails app (version 2.3.5). simple_form repository
v=1.0

Is there any way to implement the nice
options :wrapper_tag, :wrapper_class, :wrapper_error_class ? Or maybe
I'm missing something? :-D

Thank you for your advices

Fro_oo

ps : I can't change my Rails gem and upgrade to a 3.x version...

-- 
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: firebug jQuery undefined message in rails app

2010-06-16 Thread Pale Horse
First, try:

""

Instead of

""

Else:

"javascript_include_tag :all"

You can set :recursive => true if you want Rails to search all 
subdirectories of public/javascripts.
-- 
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: firebug jQuery undefined message in rails app

2010-06-16 Thread Marnen Laibow-Koser
John Merlino wrote:
> Does anyone have a step by step instruction on how to remove prototype
> completely so jQuery works? 

Sure:
1. Remove public/javascripts/prototype.js.
2. There is no step 2.

> The jRails plugin seems to make them work
> together. I want to remove prototype as I will never use it.

Perhaps unwise.  After some experimentation with both, I'm include to 
believe that Prototype may be the better of the two.  I want to play 
with both a little more before I state that as fact, though.

> Thanks

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: ruby/lib/ruby/site_ruby/1.8/rubygems.rb:270:in `activate': u

2010-06-16 Thread Pale Horse
Mamadou Touré wrote:
>
> Hi folks,
> 
> I'm getting the following error while trying to start the Webrick serve
> on a old project that I just checked out from our svn. Could you tell me
> what's wrong ?
> 
> ruby/lib/ruby/site_ruby/1.8/rubygems.rb:270:in `activate': undefined
> method `map' for nil:NilClass (NoMethodError)

Looks like a version issue, though I can't be sure.
-- 
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] ruby/lib/ruby/site_ruby/1.8/rubygems.rb:270:in `activate': u

2010-06-16 Thread Mamadou Touré
Hi folks,

I'm getting the following error while trying to start the Webrick serve
on a old project that I just checked out from our svn. Could you tell me
what's wrong ?

ruby/lib/ruby/site_ruby/1.8/rubygems.rb:270:in `activate': undefined
method `map' for nil:NilClass (NoMethodError)
-- 
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: firebug jQuery undefined message in rails app

2010-06-16 Thread John Merlino
Actually stepcarousel.js which uses jquery is working in the application 
so I don't think there is a conflict with prototype. However I still get 
the error jquery is undefined.
-- 
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] Forcing helper like link_to to use single quotes

2010-06-16 Thread Michael Pavling
On 16 June 2010 18:51, Sharkie Landshark  wrote:
> For example, I want  rather than 
>
> I want to maintain consistency with style.

You want to change the correct (according to the xhtml guidelines)
double-quotes, to incorrect single quotes?


Wouldn't it be better to change the single quotes to double? (For
compliance, rather than consistence).

-- 
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] Forcing helper like link_to to use single quotes

2010-06-16 Thread Sharkie Landshark
For example, I want  rather than 

I want to maintain consistency with style.

Can this be done?

Also, I am trying to use Rails 3.0.

Sharkie
-- 
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] [Share] How To Upgrade Rails 2 Become Rails 3

2010-06-16 Thread Yacobus Reinhart
Hi:

I just want share for every body here how to upgrade your application
from rails 2 become rails 3, like i did before. I hope it will be useful
for you guys, any question or advice please post here :

http://www.reinhartlab.com/2010/06/how-to-upgrade-to-rails-3-of-your-old.html

Reinhart
-- 
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: firebug jQuery undefined message in rails app

2010-06-16 Thread John Merlino
Does anyone have a step by step instruction on how to remove prototype
completely so jQuery works? The jRails plugin seems to make them work
together. I want to remove prototype as I will never use it.
Thanks
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Mac and Rails

2010-06-16 Thread Kayle
There are some wonderful guides out there for this. Rails works great
out-of-the-box on OS X.

Out of the editors I've used, I believe textmate is the best. It's
visually pleasing and very extensible. It also is the text editor seen
in the famous "Rails Casts" from 37Signals. http://macromates.com/

I use Textmate in combination with Panic's Transmit ftp software
(http://www.panic.com/transmit/) and Firefox armed with Firebug as my
environment. I find it highly productive. (I love textmate and it
seems to be one of the posterchild editors for Rails, but it will take
some time to get used to. It has a lot of great features)

You have a few options for your Rails installation...

The absolute easiest is just to update the Rails app installed with OS
X. You'll be up and running in just a few minutes:
http://wiki.rubyonrails.org/getting-started/installation/mac

If you don't want that, consider the RubyStack from BitNami:
http://bitnami.org/stack/rubystack

For maximum control, you can manually build Rails, as well:
http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard


Lastly, I've not needed to use a particular version of Rails so far,
but I believe you can install older versions of rails as Gems, if you
need them. See this article: 
http://www.nomachetejuggling.com/2008/03/12/using-multiple-versions-of-rails/


Hope that helps a little.


On Jun 14, 6:42 pm, VikramAditya  wrote:
> Hello,
>
> I have been just tasked to learn Rails for a new project and have been
> given Mac machine for it. I have never used a Mac / Linux ever. I have
> used Rails before on Windows. I need to set up Rails development env
> on this Mac machine. Its Mac OS X - Snow Leopard. The development
> environment needs Rails 2.3.5, GIT client and MySQL. We are still
> swaying between using Mongreal or Apache locally, because the
> production will be in Apache.
>
> Can someone advise what the best practices, best tools, editors, etc
> to set up Rails development env locally on a Mac? Apologize for the v
> basic question. :-)
>
> Regards
> Vikram

-- 
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] firebug jQuery undefined message in rails app

2010-06-16 Thread John Merlino
In rails app, I add the following line of code in application.js and I
get jQuery is not defined in firebug console.
In application.html.erb, I have the following:



and I installed jquery in public/javascripts

Any ideas what's going wrong? thanks for reply.

(function($) {

var linksToInt = {
"#pple": 0,
"#serv": 1,
"#sol": 2,
"#dash": 3,
"#adm": 4,
"#inv": 5,
"#stu": 6

}

/*
links = document.getElementsByTagName("a");
if(links.className.indexOf("div-link") > -1){
links.onclick = function{
removeHash(this.getAttribute("href"));};
}
*/


$("a.div-link").click(function(){displayDiv($(this).attr("href"));});

function displayDiv(id){
var linkInt = linksToInt[id];
on_btn_click(linkInt);
}

function on_btn_click(displayDiv){
displayDiv != null ? null : this;

switch(displayDiv){
case 0:
$(content).empty();
$(displayDiv).show();
break;
case 1:
$(content).empty();
$(displayDiv).show();
break;
case 2:
$(content).empty();
$(displayDiv).show();
break;
case 3:
$(content).empty();
$(displayDiv).show();
break;
case 4:
$(content).empty();
$(displayDiv).show();
break;
case 5:
$(content).empty();
$(displayDiv).show();
break;
case 6:
$(content).empty();
$(displayDiv).show();
break;
}
}

})(jQuery);
-- 
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 use an active record store session model?

2010-06-16 Thread Garth
Let me know if you figure this out - I'm having the same problem.

-- Garth

-- 
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: URL Hiding

2010-06-16 Thread Philip Hallstrom

On Jun 16, 2010, at 9:28 AM, JuKuen wrote:

> The idea is generating url`s which will hide what is the database used
> to store the information and hiding the server side language wrapper.
> example:
> http://www.amazon.com/gp/product/1934356166/ref=s9_simv_bw_p14_i2?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-4&pf_rd_r=0QDPNRG9W6H5YTMMF2G9&pf_rd_t=101&pf_rd_p=41171042&pf_rd_i=283155
> the idea is in the string generated after the product/ folder

Hiding the database shouldn't require any additional work beyond making sure 
your error messages don't point out that the database is.

Hiding the server side language is harder... regardless of what URL you use.

For example... if /images/rails.png exists, good chance it's Rails :)  Lots of 
people forget to remove it.

Or, if the server sends back the following header...

X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 2.2.5

Good chance it's Rails.  You can configure it not to do this, but there are 
other ways too... just look for common Rails idioms (asset timestamping, etc.)  

Dig deeper at the network level and you can even figure out the OS in many 
cases...

Just saying that it's probably not possible to truly hide this information from 
someone determined enough to get it.

-philip

-- 
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] Off Topic Advice Needed (Time objects)

2010-06-16 Thread Ants Pants
On 16 June 2010 18:07, Michael Pavling  wrote:

> On 16 June 2010 16:45, Ants Pants  wrote:
> > As I have said before, I have no problems with all of that but thanks for
> > the suggestions.
>
> To be honest, I don't really understand what you're asking for help
> with. If you can state your position in different terms, because what
> you've said so far obviously hasn't clicked with anyone (or at least
> we've clicked the same, wrong, way! ;-)
>
> Feeling around in the dark a little:
> http://snippets.dzone.com/posts/show/1137
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/170729
>
> The code you posted does look a little smelly. I don't know why you're
> turning your numbers into strings and then back into numbers again.
> For instance, where you say " ## need validation (can't have hundtedth
> without tenth, for example)", I think you could ignore if you just
> approach adding up the seconds differently.
>
> So for instance if :
>   time_units = {:seconds => 22, :hundredths => 0, :milliseconds => 8}
>
> you can just do the arithmetic:
>
>  fraction = 0
>  fraction += time_units[:tenths] * .1 if time_units.has_key?(:tenths)
>  fraction += time_units[:hundredths] * .01 if
> time_units.has_key?(:hundredths)
>  fraction += time_units[:milliseconds] *.001 if
> time_units.has_key?(:milliseconds)
>
> should result in 0.008
>
> Frankly, stuff the fraction variable. Treat @decimal_time the same:
>  @decimal_time += time_units[:seconds] if time_units.has_key?(:seconds)
>  @decimal_time += time_units[:minutes] * 60 if
> time_units.has_key?(:minutes)
>  @decimal_time += time_units[:hours] * 3600 if time_units.has_key?(:hours)
>  @decimal_time += time_units[:milliseconds] *.001 if
> time_units.has_key?(:milliseconds)
>  etc...
>
>
> Of course, ignore me if there's some critical reason they *must* be
> strings! :-)
>
> --
> 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.
>
>
Not to worry about this as I'm happy where I'm going. Logically it's not a
huge problem, getting it Rubyish might be ;) Long time Perl programmer.

Thanks for the links, I'd already seen the second link.

Thanks for the bit about the fractions, it's given me something to think
about but from what I can see, they will still have to be tacked on to the
decimal. The decimals were done the way you suggested but now they're just
in a loop (more flexible) as time_units may well be added in the future.

I don't want to labour on this so I'll just do what I was going to do.
Again, 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] Re: URL Hiding

2010-06-16 Thread Michael Pavling
On 16 June 2010 17:28, JuKuen  wrote:
> The idea is generating url`s which will hide what is the database used
> to store the information and hiding the server side language wrapper.

What do *your* URLs look like now that gives away the DB and
server-side language?

-- 
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: link_to with "data-confirm"

2010-06-16 Thread Ray Parker
Did you find a solution to this?  I just hit this myself last night and 
have spent a few hours trying to find an answer.
-- 
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: URL Hiding

2010-06-16 Thread JuKuen
The idea is generating url`s which will hide what is the database used
to store the information and hiding the server side language wrapper.
example:
http://www.amazon.com/gp/product/1934356166/ref=s9_simv_bw_p14_i2?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-4&pf_rd_r=0QDPNRG9W6H5YTMMF2G9&pf_rd_t=101&pf_rd_p=41171042&pf_rd_i=283155
the idea is in the string generated after the product/ folder

On Jun 16, 6:01 pm, Hassan Schroeder 
wrote:
> On Wed, Jun 16, 2010 at 12:52 AM, JuKuen  wrote:
> > Someting like Amazon`s strings, which are generating as url`s.
>
> I still have no idea what you're talking about.
>
> Maybe you could provide an actual example, or explain what goal you
> are trying to achieve?
>
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
> twitter: @hassan

-- 
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] Field validation

2010-06-16 Thread Colin Law
On 16 June 2010 11:34, Stanislav Orlenko  wrote:
> Hi
> I have a field called "cost":
>
> <%= f.text_field :cost, :size=>2, :maxlength=>4 %>
>
> I want to check that user enter numeral value and this value is integer
>
> In post.rb (model):
>
>    def cost_validate_int
>      errors.add_to_base("Error message") unless cost.is_a?(Fixnum)
>      puts "### #{cost}: "+cost.class.to_s
>    end
>
> When I enter in field 100 I get:
>
> ### 100: Fixnum
>
> when I enter 10.1:
>
> ### 10: Fixnum
>
> when I enter 'asdf':
>
> ### 0: Fixnum
>
> I completely can't understand what happen. In migration:
>
> t.integer :cost
>
> I think ActiveRectord converts value to Fixnum because in migration this
> field signed as integer

How is the string you enter getting into the cost attribute?

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.



Re: [Rails] Re: form select not saving to the database

2010-06-16 Thread Colin Law
On 16 June 2010 09:40, Pale Horse  wrote:
> Marnen Laibow-Koser wrote:
>> the batman wrote:
>>> <%= f.label :type %>
>>> <%= f.select(:type, ["original","print","other"]) %>
>>>
>>> I have a photos model and added a drop-down list to the form, when the
>>> option is selected, the correct parameters are passed but it is not
>>> saved to the database.
>>> I've googled this and looked at the api but I'm not sure what I'm doing.
>>> In my photo model type is a string.
>>>
>>> Is string the wrong field type? or anything else wrong?
>>
>> Oh, disregard my earlier post.  I just realized what's going on.  Rails
>> reserves the field name "type" for STI purposes, and gets confused if
>> you try to use that name for an ordinary field.
>>
>> Best,
>> --
>> Marnen Laibow-Koser
>> http://www.marnen.org
>> mar...@marnen.org
>
> I recently encountered this same problem. I simply changed the column to
> 'category' and solved the problem. Though, it took far too long for me
> to realise this.

This is a useful page to refer to when strange things are going on
that do not seem to make sense.
http://wiki.rubyonrails.org/rails/pages/ReservedWords

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.



Re: [Rails] Off Topic Advice Needed (Time objects)

2010-06-16 Thread Michael Pavling
On 16 June 2010 16:45, Ants Pants  wrote:
> As I have said before, I have no problems with all of that but thanks for
> the suggestions.

To be honest, I don't really understand what you're asking for help
with. If you can state your position in different terms, because what
you've said so far obviously hasn't clicked with anyone (or at least
we've clicked the same, wrong, way! ;-)

Feeling around in the dark a little:
http://snippets.dzone.com/posts/show/1137
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/170729

The code you posted does look a little smelly. I don't know why you're
turning your numbers into strings and then back into numbers again.
For instance, where you say " ## need validation (can't have hundtedth
without tenth, for example)", I think you could ignore if you just
approach adding up the seconds differently.

So for instance if :
   time_units = {:seconds => 22, :hundredths => 0, :milliseconds => 8}

you can just do the arithmetic:

  fraction = 0
  fraction += time_units[:tenths] * .1 if time_units.has_key?(:tenths)
  fraction += time_units[:hundredths] * .01 if time_units.has_key?(:hundredths)
  fraction += time_units[:milliseconds] *.001 if
time_units.has_key?(:milliseconds)

should result in 0.008

Frankly, stuff the fraction variable. Treat @decimal_time the same:
  @decimal_time += time_units[:seconds] if time_units.has_key?(:seconds)
  @decimal_time += time_units[:minutes] * 60 if time_units.has_key?(:minutes)
  @decimal_time += time_units[:hours] * 3600 if time_units.has_key?(:hours)
  @decimal_time += time_units[:milliseconds] *.001 if
time_units.has_key?(:milliseconds)
  etc...


Of course, ignore me if there's some critical reason they *must* be strings! :-)

-- 
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] mysql gem install not happening on Mac OS Leopard - any inputs at all??

2010-06-16 Thread Hassan Schroeder
On Tue, Jun 15, 2010 at 1:41 AM, Ram  wrote:

> Ive got Mac OS X Leopard (10.5.8), ruby 1.8.6 (2009-06-08 patchlevel
> 369) [universal-darwin9.0] and mysql 5.0.67 installed and working fine
> with Rails 2.1.0.

> Im trying to upgrade my Rails apps to 2.3.5 but when i try to install
> the mysql gem

If it was "working fine with Rails 2.1.0" and you're just upgrading Rails
itself, why are you trying to (re-)install the mysql gem?

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

-- 
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: class methods from module where active rec is involved

2010-06-16 Thread Jedrin
oops, I needed to do

self.primary_key = 'something'

On Jun 16, 11:43 am, Jedrin  wrote:
>  I have a module as shown below and when I extend an active record to
> use it, I can not access the
> primary_key method. In a simple test program using a similar approach
> where active record is not involved, access to the class methods seems
> to work ok. What can I do to make this work or so that I can access
> the class methods ?
>
> ##
>
> require 'active_record'
>
> DB_Host = 'localhost'
> DB_Database = 'proj1'
> DB_Port = 5432
>
> ActiveRecord::Base.establish_connection(
>   :adapter => "postgresql",
>   :host => DB_Host,
>   :database => DB_Database,
>   :username => "me"
> #  :password => "secret"
> )
>
> module ModelClassMethods
>
>  def mycreate(pkey_val)
>    pkey_fld = self.primary_key
>  end
>
> end
>
> class ActiveNode < ActiveRecord::Base
>   extend ModelClassMethods
>
>   # include ModelMethods
> end

-- 
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: class methods from module where active rec is involved

2010-06-16 Thread Jedrin
oops, I needed to do

self.primary_key = 'something'

On Jun 16, 11:43 am, Jedrin  wrote:
>  I have a module as shown below and when I extend an active record to
> use it, I can not access the
> primary_key method. In a simple test program using a similar approach
> where active record is not involved, access to the class methods seems
> to work ok. What can I do to make this work or so that I can access
> the class methods ?
>
> ##
>
> require 'active_record'
>
> DB_Host = 'localhost'
> DB_Database = 'proj1'
> DB_Port = 5432
>
> ActiveRecord::Base.establish_connection(
>   :adapter => "postgresql",
>   :host => DB_Host,
>   :database => DB_Database,
>   :username => "me"
> #  :password => "secret"
> )
>
> module ModelClassMethods
>
>  def mycreate(pkey_val)
>    pkey_fld = self.primary_key
>  end
>
> end
>
> class ActiveNode < ActiveRecord::Base
>   extend ModelClassMethods
>
>   # include ModelMethods
> end

-- 
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] Off Topic Advice Needed (Time objects)

2010-06-16 Thread Ants Pants
On 16 June 2010 16:57, Michael Pavling  wrote:

> On 16 June 2010 15:51, Ants Pants  wrote:
> > I don't have a problem with comparing floats, but I might need to find
> the
> > 10 closest times to the actual event time and 4 of those times could be
> less
> > than the actual event time and 6 could be higher.
>
> As a starting point, IIWM I would:
>  * Get the ten times either side (so I have twenty objects).
>  * Calculate the difference of how far each is from the event (ignoring
> sign)
>  * Order the twenty by the difference
>  * Take the first ten of them.
>
> With a bit of thought this could all be done in SQL... possibly with a
> couple of sub-queries. But it could certainly be stepped through in
> Ruby very easily.
>
> --
> 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.
>
>
As I have said before, I have no problems with all of that but thanks for
the suggestions. Things do get a bit more complicated with the Calculator,
though and I was only looking to make sure I wasn't wasting my time when
there was something already out there.

I'll just press on. Again, thanks for your time.

-- 
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] class methods from module where active rec is involved

2010-06-16 Thread Jedrin

 I have a module as shown below and when I extend an active record to
use it, I can not access the
primary_key method. In a simple test program using a similar approach
where active record is not involved, access to the class methods seems
to work ok. What can I do to make this work or so that I can access
the class methods ?



##

require 'active_record'


DB_Host = 'localhost'
DB_Database = 'proj1'
DB_Port = 5432


ActiveRecord::Base.establish_connection(
  :adapter => "postgresql",
  :host => DB_Host,
  :database => DB_Database,
  :username => "me"
#  :password => "secret"
)

module ModelClassMethods

 def mycreate(pkey_val)
   pkey_fld = self.primary_key
 end

end

class ActiveNode < ActiveRecord::Base
  extend ModelClassMethods

  # include ModelMethods
end



-- 
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 link_to :remote

2010-06-16 Thread Matt Royer
Update for anyone that needs help in this area. I found my problem. You 
might have to do the same (if you are using this function the way I am).

In my controller, I don't know why I put this in the Index action 
before. It is now in the SHOW (duh) action:


format.js {
  render(:update) {|page| page.replace_html 'order_div', :partial => 
'orders/order_show'}
}


I took out all of the other junk in my "link_to" in the view and only 
have this now:


<%= link_to "#{order.name}", order, :remote => true %>


So I have a list of orders in a column on the left side of the screen. 
There is a right border separating it and the right column. When I click 
on one of the orders, it shows the order info in the right column. 
Exactly what I wanted. Piece of cake now that I think about it.

Enjoy!
-- 
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] Learning RoR

2010-06-16 Thread Juan Pablo Genovese
If you are new to Ruby too, don't forget to take a look at "The Well
Grounded Rubyist". It's an awesome book.

2010/6/15 Ryan Kneer 

> Hey.  I'm just getting into RoR and was hoping someone could direct me
> to the best learning resources.
>
> P.S.: I took a couple computer sciences courses in university (learned
> some Java and C++).
>
> Cheers,
> Ryan
>
> --
> 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.
>
>


-- 
Mis mejores deseos,
Best wishes,
Meilleurs vœux,

Juan Pablo
--
http://www.twitter.com/eljuanchosf

-- 
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 call a function after 10 minutes or second?

2010-06-16 Thread Robert Walker
Vuong Hung wrote:
> Hi all,
> 
> I have a problem.
> 
> I want to call some function after every 10 minutes. But I don't it.

Please provide more detail. Are you asking about server-side or 
client-side?

If you are asking about server-side there are options like delayed_job:

http://github.com/collectiveidea/delayed_job

Or, in case the action to perform is very simple you can use use 
something like curl to send requests periodically to a url using cron:

$ crontab -e
*/10 * * * * curl http://example.com/action

If you're talking about client-side (JavaScript) then there are timing 
events that you can use for delayed or repeating events:

http://www.w3schools.com/js/js_timing.asp

If you're using the Prototype JavaScript library it provides the 
Ajax.PeriodicalUpdater if you want to repeatedly send a request on an 
interval.

http://api.prototypejs.org/ajax/ajax/periodicalupdater/
-- 
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] Learning RoR

2010-06-16 Thread DK
Try the book Agile Web Development with Rails. If you go through the
tutorial you will have a foundation.

On 6/15/10, Ryan Kneer  wrote:
> Hey.  I'm just getting into RoR and was hoping someone could direct me
> to the best learning resources.
>
> P.S.: I took a couple computer sciences courses in university (learned
> some Java and C++).
>
> Cheers,
> Ryan
>
> --
> 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.
>
>

-- 
Sent from my mobile device

-- 
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: Building a Cascading Drop Down Selection List for Ruby on Rails with jQuery Ajax

2010-06-16 Thread Me
Easiest would be to make the select a partial and update the partial
based on the object sent to the query.  You make an ajax call when an
item is selected, query the db, replace the select you want to update
with the partial with the items scoped for the parent object.

On Jun 16, 9:11 am, Ian Irving  wrote:
> Cascading Drop Down Selection Lists are when the value of a second
> drop down are filtered based on the values a first field (usually a
> drop down, but could be a radio box, check box or even text)
>
> Select a Country and then State or Province;  or Select a Car
> Manufacture and then a Car Model.
>
> This time of feature is has also been called Related Drop Down fields
> or Dependant Drop Down lists or Dynamic Drop Downs or Dependent Drop
> Downs.
>
> I've posted code and discussion over 
> athttp://www.falsepositives.com/index.php/2010/05/28/building-a-casscad...
>
> The code is built and Tested with Ruby on Rails 2.3.5 and jQuery
> 1.4.2
>
> Hope you find this useful. feedback welcome.
>
> Ian Irving
> Toronto, Canada
> Code and Culture :http://www.FalsePositives.com
> Building the People and Data Driven Web :http://www.ConnectedThinking.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: URL Hiding

2010-06-16 Thread Hassan Schroeder
On Wed, Jun 16, 2010 at 12:52 AM, JuKuen  wrote:
> Someting like Amazon`s strings, which are generating as url`s.

I still have no idea what you're talking about.

Maybe you could provide an actual example, or explain what goal you
are trying to achieve?

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

-- 
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] Off Topic Advice Needed (Time objects)

2010-06-16 Thread Michael Pavling
On 16 June 2010 15:51, Ants Pants  wrote:
> I don't have a problem with comparing floats, but I might need to find the
> 10 closest times to the actual event time and 4 of those times could be less
> than the actual event time and 6 could be higher.

As a starting point, IIWM I would:
  * Get the ten times either side (so I have twenty objects).
  * Calculate the difference of how far each is from the event (ignoring sign)
  * Order the twenty by the difference
  * Take the first ten of them.

With a bit of thought this could all be done in SQL... possibly with a
couple of sub-queries. But it could certainly be stepped through in
Ruby very easily.

-- 
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] Off Topic Advice Needed (Time objects)

2010-06-16 Thread Andy Jeffries
>
> If you have two floating point values representing seconds (and parts of)
>> why can't you just compare the two floating point values?
>>
>> What part are you stuck with?  Can you give us some code with a comment on
>> which bit you can't do.
>>
>
>> I don't have a problem with comparing floats, but I might need to find the
> 10 closest times to the actual event time and 4 of those times could be less
> than the actual event time and 6 could be higher.
>
> I don't mind rolling my own and am quite looking forward to it, but I don't
> want to re-invent the proverbial wheel.
>

This seems a fairly simple wheel to be worried about re-inventing though (or
even to look forward to).

OK, so you have an array of times.  You sort through them based on:

(predicted_time - actual_time).abs

and pick the smallest 10 items.

Cheers,


Andy

-- 
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] Off Topic Advice Needed (Time objects)

2010-06-16 Thread Ants Pants
On 16 June 2010 15:54, Andy Jeffries  wrote:

> These values are then converted to seconds and stored as decimal in the DB
>> (I allow fractions of a second, too (tenth, hundredth, millisecond). when
>> they are retrieved form the DB, I convert the seconds to a string format of,
>> for example, 01:39:11 (from 5951 seconds). If fractions are used,  they are
>> just appended to the string. (non of this is elegant IMO)
>>
>> That's all done in my Converter class. I am going to write a Calculator
>> class to compare all times entered for an event and picking the closest
>> times to how long the actual event took.
>>
>> So my question is, I know I can't use a Time object but it would be really
>> nice to know if there is something out there that could help me with this as
>> to write my own Calculator is going to be a bit of a pain.
>>
>
> If you have two floating point values representing seconds (and parts of)
> why can't you just compare the two floating point values?
>
> What part are you stuck with?  Can you give us some code with a comment on
> which bit you can't do.
>
>
> Andy
>
> --
> 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.
>

I don't have a problem with comparing floats, but I might need to find the
10 closest times to the actual event time and 4 of those times could be less
than the actual event time and 6 could be higher.

I don't mind rolling my own and am quite looking forward to it, but I don't
want to re-invent the proverbial wheel.

FWIW, here's the conversion code to convert integer values to their
respective seconds.

@@time_constants = {:years => YEAR,
  :months => MONTH,
  :weeks => WEEK,
  :days => DAY,
  :hours => HOUR,
  :mins => MIN  }

def to_decimal(time_units={})
  raise ArgumentError if time_units.empty?

  time_units.each_pair do |key, value|
## skip seconds and fractions thereof
next unless @@time_constants.has_key?(key)
## convert integer time units into seconds
@decimal_time += @@time_constants[key] * value
  end
  ## whack on the seconds
  @decimal_time += time_units[:secs] if time_units.has_key?(:secs)

  ## need validation (can't have hundtedth without tenth, for example)
  fraction = ''
  fraction = '.' + time_units[:tenth].to_s  if
time_units.has_key?(:tenth)
  fraction << time_units[:hundredth].to_s   if
time_units.has_key?(:hundredth)
  fraction << time_units[:millisecond].to_s if
time_units.has_key?(:millisecond)

  ## concat fraction string to @decimal_time, convert to float for DB
  @decimal_time = (@decimal_time.to_s << fraction).to_f
end

-- 
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] Senior Ruby on Rails Developer Needed! Can you help?

2010-06-16 Thread Michael Pavling
On 16 June 2010 13:01, Paul  wrote:
> Can you help?!?!

Can you supply some more information before we waste your time with our CVs...

Where is this job? This list has an international membership. Is
telecommuting acceptable?

Is it a permanent or contract job?

How much (ball-park even) is the remuneration?

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] Re: Install Plugins into vendor/plugins

2010-06-16 Thread Ian Irving
installing in the vendor/plugins  (not app ) directory is done with
the use "script/plugin"

using "script/plugin -h" will get you full help

generally you install from a known a subversion URL:

   plugin install 
http://dev.rubyonrails.com/svn/rails/plugins/continuous_builder

 or you install a plugin from known a git URL:
plugin install git://github.com/SomeGuy/my_awesome_plugin.git

Ian
Code and Culture :http://www.FalsePositives.com
Building the People and Data Driven Web : http://www.ConnectedThinking.com

On Jun 14, 7:56 pm, Jonhy Pear  wrote:
> Hi,
>
> I'm using some plugins in rails 2.3.5 but they are not currently installed
> in app/vendor/plugins
>
> How do I install them in the app/vendor/plugins?
>
> 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] Building a Cascading Drop Down Selection List for Ruby on Rails with jQuery Ajax

2010-06-16 Thread Ian Irving
Cascading Drop Down Selection Lists are when the value of a second
drop down are filtered based on the values a first field (usually a
drop down, but could be a radio box, check box or even text)

Select a Country and then State or Province;  or Select a Car
Manufacture and then a Car Model.

This time of feature is has also been called Related Drop Down fields
or Dependant Drop Down lists or Dynamic Drop Downs or Dependent Drop
Downs.

I've posted code and discussion over at
http://www.falsepositives.com/index.php/2010/05/28/building-a-casscading-drop-down-selection-list-for-ruby-on-rails-with-jquery-ajax/

The code is built and Tested with Ruby on Rails 2.3.5 and jQuery
1.4.2

Hope you find this useful. feedback welcome.

Ian Irving
Toronto, Canada
Code and Culture : http://www.FalsePositives.com
Building the People and Data Driven Web : http://www.ConnectedThinking.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] Senior Ruby on Rails Developer Needed! Can you help?

2010-06-16 Thread Paul
Can you help?!?!

Are you considering a career move at the moment? Would you be
interested working for one of the world's leading mobile
organisations? Are you looking for a web development role that will
impact millions of people?

I have one of my largest clients, a global mobile telecommunications
organisation who I am assiting in finding Senior Ruby on Rails
Developers for.

If you are interested please get in touch as I would be happy to
discuss the details with you.

Paul
paul.tur...@darwinrecruitment.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: database.yml host read from yml

2010-06-16 Thread Chris Habgood
Ok, in my load_config I do this:

Site = YAML.load_file(File.join(RAILS_ROOT, 'config', 'sites.yml'))

Something like this in the database.yml?

host: <%= Site['name']['db'] %>

On Wed, Jun 16, 2010 at 03:26, Frederick Cheung
wrote:

>
>
> On Jun 14, 6:50 pm, Me  wrote:
> > I have a yml file with ip info.  When I try to do " host:  Site['name']
> > ['ip']  it is getting interpreted directly and it is saying Bad URI:
> > Site['name']['ip']
> >
> > How do I get the database yml to interpret the Site constant?  I can
> > see the hash in the console.
>
> database.yml is passed through erb
>
> 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.
>
>

-- 
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] Off Topic Advice Needed (Time objects)

2010-06-16 Thread Andy Jeffries
>
> These values are then converted to seconds and stored as decimal in the DB
> (I allow fractions of a second, too (tenth, hundredth, millisecond). when
> they are retrieved form the DB, I convert the seconds to a string format of,
> for example, 01:39:11 (from 5951 seconds). If fractions are used,  they are
> just appended to the string. (non of this is elegant IMO)
>
> That's all done in my Converter class. I am going to write a Calculator
> class to compare all times entered for an event and picking the closest
> times to how long the actual event took.
>
> So my question is, I know I can't use a Time object but it would be really
> nice to know if there is something out there that could help me with this as
> to write my own Calculator is going to be a bit of a pain.
>

If you have two floating point values representing seconds (and parts of)
why can't you just compare the two floating point values?

What part are you stuck with?  Can you give us some code with a comment on
which bit you can't do.


Andy

-- 
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: Different each iteration

2010-06-16 Thread Pale Horse
Marnen Laibow-Koser wrote:
> 
> There's also in_groups_of.
> 
> 
> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> mar...@marnen.org

I'd forgotten about that method. In addition, you can 
each_slice(integer) to divide an array. Though, 'enumerator' is required 
in your Active Record model. I would recommend this approach if you're 
splitting arrays into columns or rows. Else, batch_size and in_groups_of 
are useful for retrieving large data sets.
-- 
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: Different each iteration

2010-06-16 Thread Marnen Laibow-Koser
Pale Horse wrote:
> Greg Ma wrote:
>> Hi,
>> I've read a few days ago that rails has a each method that allows you to
>> speficy the number of iteration. I think the default number was 1000.
>> What is the name of the method?
>> 
>> myList.each_with_something or myList.each_something
>> 
>> Greg
> 
> You can specify the batch_size as an option to a find_each method. Batch 
> methods should be used when your request retrieves large amounts of 
> data:
> 
> "When processing large numbers of records, it's often a good idea to do 
> so in batches to prevent memory ballooning."

There's also in_groups_of.


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: Problem submiting value, form_for, link-to-remote, javascrip

2010-06-16 Thread Neil Bye
Neil Bye wrote:
> This is my form. It creates a comment in the database but won't pass the
> 'body' value. I think the problem is passing the variable to javascript.
> Can anyone help?
> 
>  <% form_for :comment, :url=>story_comments_path(@story), :name =>
> 'form' do |form| %>
>   
>Comment:
><%= form.text_field :body %>
><%= link_to_remote('comment',{ :url=>
>  {:controller => 'comments' ,
>   :action => 'create',
>   :story_id => @story.id,
>   :method => 'get',
>   :with   =>
> 'serialize_fields()' }}) %>
> 
>   <% end %>
> 
> This is the javascript.
> 
> 
> function serialize_fields(){
>   var fields = new Array();
>   fields.push(Form.Element.serialize('document.form.body'));
>   return fields.join('&');
> }
> 

I tried this too

:with=>"'body' + $F('body')"


That doesn't work either. How can I pass this parameter?
-- 
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: I installed rails 3 and how to install rails 2

2010-06-16 Thread Ugis Ozols
You can install any rails version like this: gem install rails -
v=2.3.8
...and to generate app with specific version do like this: rails
_2.3.8_ app_name

On Jun 16, 10:02 am, karnati kiran 
wrote:
> Hi all,
>
> i installed rails 3 and how to install rails 2 in the  same machine please
> help me
>
> 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] Re: Newbie trying to set up rails with MySQL

2010-06-16 Thread gezope
Yep,
my problems was almost the same! And still not workable with mysql, I
don"t know why. Please let me know if you have useful answer!
Thnaks,
gezope

On jún. 15, 23:13, Sarah Faulkner  wrote:
> Hello --
>
> Please pardon my newness -- I'm just getting started with rails, and
> I'm having some difficulty getting it set up with MySQL.
>
> I am able to get the basic ruby server running (script\server). When I
> created a new page (using script/generate controller about index), I
> am not able to navigate to the new page, and Ruby either crashes or
> gives me an error:
>
> /!\ FAILSAFE /!\  Tue Jun 15 13:53:08 -0700 2010
>   Status: 500 Internal Server Error
>   Access denied for user 'root'@'localhost' (using password: NO)
>
> I have modified the database.yml file (full text of file pasted
> below). I know the password is correct, as it is what I use to launch
> mysql. When I enter 'show databases' into MySQL monitor, I see the two
> databases I specified (emporium_development and emporium_test). The
> MySQL service is running (I'm on Win7). I have tried both restarting
> the MySQL service and restarting the ruby server. I created the
> project with the command: 'rails emporium -d mysql' and prior to that,
> I installed the mysql driver for rails using the command 'gem install
> mysql'. I installed the 105.4 MB mysql from 
> here:http://dev.mysql.com/downloads/mysql/5.1.html#downloads, but I have
> not installed anything else (outside of rails).
>
> Thank you for any help you can offer!!
> Sarah
>
> database.yml:
>
> # MySQL.  Versions 4.1 and 5.0 are recommended.
> #
> # Install the MySQL driver:
> #   gem install mysql
> # On Mac OS X:
> #   sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
> # On Mac OS X Leopard:
> #   sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-
> config=/usr/local/mysql/bin/mysql_config
> #       This sets the ARCHFLAGS environment variable to your native
> architecture
> # On Windows:
> #   gem install mysql
> #       Choose the win32 build.
> #       Install MySQL and put its /bin directory on your path.
> #
> # And be sure to use new-style password hashing:
> #  http://dev.mysql.com/doc/refman/5.0/en/old-client.html
>
> development: adapter: mysql
> encoding: utf8
> reconnect: false
> database: emporium_development
> pool: 5
> username: root
> password: hacked
> host: localhost
>
> # Warning: The database defined as "test" will be erased and
> # re-generated from your development database when you run "rake".
> # Do not set this db to the same as development or production.
>
> test: adapter: mysql
> encoding: utf8
> reconnect: false
> database: emporium_test
> pool: 5
> username: root
> password: hacked
> host: localhost
>
> Full Error Text:
> C:\webapp\emporium>ruby script\server
> => Booting WEBrick
> => Rails 2.3.8 application starting onhttp://0.0.0.0:3000
> => Call with -d to detach
> => Ctrl-C to shutdown server
> [2010-06-15 13:52:56] INFO  WEBrick 1.3.1
> [2010-06-15 13:52:56] INFO  ruby 1.8.6 (2010-02-04) [i386-mingw32]
> [2010-06-15 13:52:56] INFO  WEBrick::HTTPServer#start: pid=3664
> port=3000
> /!\ FAILSAFE /!\  Tue Jun 15 13:53:04 -0700 2010
>   Status: 500 Internal Server Error
>   Access denied for user 'root'@'localhost' (using password: NO)
>     C:/Ruby186/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/
> active_record/conne
> ction_adapters/mysql_adapter.rb:619:in `real_connect'
>     C:/Ruby186/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/
> active_record/conne
> ction_adapters/mysql_adapter.rb:619:in `connect'
>     C:/Ruby186/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/
> active_record/conne
> ction_adapters/mysql_adapter.rb:203:in `initialize'
>     C:/Ruby186/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/
> active_record/conne
> ction_adapters/mysql_adapter.rb:75:in `new'
>     C:/Ruby186/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/
> active_record/conne
> ction_adapters/mysql_adapter.rb:75:in `mysql_connection'
>     C:/Ruby186/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/
> active_record/conne
> ction_adapters/abstract/connection_pool.rb:223:in `send'
>     C:/Ruby186/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/
> active_record/conne
> ction_adapters/abstract/connection_pool.rb:223:in `new_connection'
>     C:/Ruby186/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/
> active_record/conne
> ction_adapters/abstract/connection_pool.rb:245:in
> `checkout_new_connection'
>     C:/Ruby186/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/
> active_record/conne
> ction_adapters/abstract/connection_pool.rb:188:in `checkout'
>     C:/Ruby186/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/
> active_record/conne
> ction_adapters/abstract/connection_pool.rb:184:in `loop'
>     C:/Ruby186/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/
> active_record/conne
> ction_adapters/abstract/connection_pool.rb:184:in `checkout'
>     C:/Ruby186/lib/ruby/1.8/monitor.rb:242:in `synchronize'
>     C:/Ruby186/lib/ruby/gems/1.8/gems/activerecord-2.3.

[Rails] Off Topic Advice Needed (Time objects)

2010-06-16 Thread Ants Pants
I know this is a Ruby question but I'm not on any Ruby mailing lists and
it's for a Rails project (so might come under select_time etc. ;) ) I
thought I'd try here.

A user can choose integer values from select drop down boxes to predict how
long an event will take. Obvious values are secs (0-59), minutes (0-59) 
weeks (0-4), months (0-11) ...

These values are then converted to seconds and stored as decimal in the DB
(I allow fractions of a second, too (tenth, hundredth, millisecond). when
they are retrieved form the DB, I convert the seconds to a string format of,
for example, 01:39:11 (from 5951 seconds). If fractions are used,  they are
just appended to the string. (non of this is elegant IMO)

That's all done in my Converter class. I am going to write a Calculator
class to compare all times entered for an event and picking the closest
times to how long the actual event took.

So my question is, I know I can't use a Time object but it would be really
nice to know if there is something out there that could help me with this as
to write my own Calculator is going to be a bit of a pain.

Also, by throwing this out there, somebody might say something that I
haven't thought of doing and could totally change the way I'm doing this.

CIA

-Ants

-- 
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: Ruby on Rails Analyst/Programmers, Glasgow.

2010-06-16 Thread Pale Horse
Deirdre Shell wrote:
>
> PH, Thank you for the reply.  I am trying to assess how available A/Ps 
> will be hence this question.   What's API mean here? The company already 
> use RoR, they are looking for more developers, that's where I have come 
> in.
> 
> Deirdre

Firstly, the availability of RoR Developers in the area specified is 
impossible for me to determine but there is *certainly* a lot of logic 
in making the opportunity available to CS graduates; as I said, they 
should be more than capable of understanding Ruby and the way in which 
it communicates with Rails.

Secondly, an API is an interface that considers the expansion and 
development of an application by providing it with support and 
information for additional implementations. http://api.rubyonrails.org/ 
is a specific example of this.

My apologies, I assumed the company had no current developers and were 
looking to build a team from the foundations.
-- 
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: Field validation

2010-06-16 Thread Stanislav Orlenko
Pale Horse wrote:
> Stanislav Orlenko wrote:
>>
>> Can I in some way check cost value in model (value should be numeral and
>> integer)?
>> 
>> Thanks in advance!
> 
> validates_numericality_of?

I use errors.add_to_base because I don't want to show field's name in 
the error message(i. e. Cost bla bla bla. web site is localized).
-- 
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: Ruby on Rails Analyst/Programmers, Glasgow.

2010-06-16 Thread Deirdre Shell
PH, Thank you for the reply.  I am trying to assess how available A/Ps 
will be hence this question.   What's API mean here? The company already 
use RoR, they are looking for more developers, that's where I have come 
in.

Deirdre


Pale Horse wrote:
> Deirdre Shell wrote:
>>
>> Hi All,
>> 
>> I would like your advice.  I'm helping a young company set up a ROR team
>> from entry level to Senior A/P. I've not worked with this tech before so
>> have some basic questions.
>> 
>> What are your thoughts:
>> Is this a well exploited technology in Scotland/UK?
>> What's the typical career path for an RoR A/P ( from a PHP background or
>> other)?
>> If a CS grad, is it difficult to pick up - how long would you think it
>> takes to become proficient?
>> 
>> Thanks in advance for any insights shared.
>> 
>> Deirdre
> 
> Firstly, it doesn't matter how well exploited the technology is because 
> the support you (may) require for it can be done remotely. This includes 
> hosting, of course. RoR already has an extensive community and a growing 
> API, with support from major banking bodies and other industry-specific 
> experts.

> 
> Secondly, A CS graduate is likely to have studied C of some variation 
> and should, considering their assumed capabilities, be able to 
> understand the structure of Ruby and the way in which it communicates 
> with Rails. 
> 
> Thirdly, may I ask why you have nominated the use of RoR? Surely, it 
> would be better to let the Senior team decide which language is more 
> suitable. I am asking this in spite of using RoR myself.   



-- 
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] Ruby on Rails Analyst/Programmers, Glasgow.

2010-06-16 Thread Michael Pavling
On 16 June 2010 11:37, Deirdre Shell  wrote:
> I would like your advice.  I'm helping a young company set up a ROR team
> from entry level to Senior A/P.

Firstly, I'd query why there has been a choice of any technology
platform without anyone of experience to decide? Normally, I'd expect
the CTOs platform of experience is what's plumbed for. What's the
rationale for RoR? (not that it's necessarily a bad choice! ;-)

> What are your thoughts:
> Is this a well exploited technology in Scotland/UK?

In Scotland, you might try to ask at http://rubaidh.com/company -
although they may not be inclined to respond if you're starting a
competitor!

In the rest of the UK there does seem to be a fair spread of us, but
it is a small pool.

> If a CS grad, is it difficult to pick up - how long would you think it
> takes to become proficient?

Very few people I have met are straight to Ruby/RoR from uni. The
majority have arrived after a period of their career and are thus
quite senior. As far as CS grads (or self-taught techies) are
concerned, you may find yourself in the position of having to teach
them everything - even re-teach a some of what they've covered in
their courses - from HTML, CSS upwards.
But on the flip side (and I worked with one guy like this) very bright
people *can* pick stuff up very quickly.

> Thanks in advance for any insights shared.

If you'd consider temporary help - even consultation advice while you
set up your team. Feel free to get in touch directly - I'm a freelance
developer.

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] Re: mysql gem install not happening on Mac OS Leopard - any inputs at all??

2010-06-16 Thread Ram
 :S

Im not comfortable uninstalling everything and installing it from
scratch again. Dont want to lose my existing setup. Pointers from
anyone at all?

On Jun 15, 1:52 pm, Ram  wrote:
> I also get this warning in the very beginning of the gem install. Does
> it have any relevance?
>
> WARNING:  Installing to ~/.gem since /Library/Ruby/Gems/1.8 and
>           /usr/bin aren't both writable.
> WARNING:  You don't have /Users/Ram/.gem/ruby/1.8/bin in your PATH,
>           gem executables will not run.
>
> On Jun 15, 1:41 pm, Ram  wrote:
>
>
>
> > Hello all,
>
> > Ive got Mac OS X Leopard (10.5.8), ruby 1.8.6 (2009-06-08 patchlevel
> > 369) [universal-darwin9.0] and mysql 5.0.67 installed and working fine
> > with Rails 2.1.0.
>
> > "which ruby" outputs /usr/bin/ruby. I can see the mysql symlink in /
> > usr/local/mysql. I can also see the mysql-5.0.67-osx10.5-x86 folder
> > in /usr/local .
>
> > Im trying to upgrade my Rails apps to 2.3.5 but when i try to install
> > the mysql gem, I get "ERROR: Failed to build gem native extension." I
> > tried all the following commands with and without sudo and get the
> > same error everytime
>
> > > env ARCHFLAGS="-arch i386" gem install mysql -- 
> > > --with-mysql-config=/usr/local/mysql/bin/mysql_config
> > > env ARCHFLAGS="-arch i386" gem install mysql -- 
> > > --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib 
> > > --with-mysql-include=/usr/local/mysql/include
> > > env ARCHFLAGS="-arch i386" gem install mysql -- 
> > > --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib 
> > > --with-mysql-include=/usr/local/mysql/include 
> > > --with-mysql-config=/usr/local/mysql/bin/mysql_config
> > > env ARCHFLAGS="-arch i386" gem install mysql 
> > > --with-mysql-dir=/usr/local/mysql
> > > gem install mysql -- --with-mysql-dir=/usr/local/mysql
> > > gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
>
> > Im not sure what Im doing wrong. Am I supposed to uninstall the
> > existing mysql and reinstall the latest (5.1.x) before I install the
> > mysql gem? Or are my ruby and mysql paths screwed up? Ive googled a
> > lot and tried all the suggestions (as you can see above) but none
> > work.
>
> > I raised this issue already in the group but no replies yet. So I've
> > reframed it in a simpler fashion. Even if noone knows the solution
> > right away, I'd really appreciate any inputs at all.
>
> > 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] Re: how to call a function after 10 minutes or second?

2010-06-16 Thread Pale Horse
Vuong Hung wrote:
> Hi all,
> 
> I have a problem.
> 
> I want to call some function after every 10 minutes. But I don't it.

JavaScript functions can be used for this effect in most instances. 
Though it depends on which function you want to execute, of course.
-- 
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] Ruby on Rails Analyst/Programmers, Glasgow.

2010-06-16 Thread Amala Singh
"If a CS grad, is it difficult to pick up - how long would you think it
takes to become proficient?"

It will be very difficult if you are just a CS grad.

ROR is a framework of whole set of web technologies. So, it will be very
difficult to master it in less than 6 months.


You need a strong web development technical leader with reasonable ROR
expertise for atleast a year.

CS graduates dont get educated with open source technologies. They usually
come up with Java background.

If you get graduates with PHP background and who have self-learnt Ruby
languages, you are lucky.

Put an advertisement in ROR job sites, eg
jobs.rubynow.comand see how many are turning from Glasgow.


On 16 June 2010 11:37, Deirdre Shell  wrote:

> Hi All,
>
> I would like your advice.  I'm helping a young company set up a ROR team
> from entry level to Senior A/P. I've not worked with this tech before so
> have some basic questions.
>
> What are your thoughts:
> Is this a well exploited technology in Scotland/UK?
> What's the typical career path for an RoR A/P ( from a PHP background or
> other)?
> If a CS grad, is it difficult to pick up - how long would you think it
> takes to become proficient?
>
> Thanks in advance for any insights shared.
>
> Deirdre
> --
> 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.
>
>


-- 
-- 
Nandri(Thanks in Tamil),
Amala Singh

-- 
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: Ruby on Rails Analyst/Programmers, Glasgow.

2010-06-16 Thread Pale Horse
Deirdre Shell wrote:
>
> Hi All,
> 
> I would like your advice.  I'm helping a young company set up a ROR team
> from entry level to Senior A/P. I've not worked with this tech before so
> have some basic questions.
> 
> What are your thoughts:
> Is this a well exploited technology in Scotland/UK?
> What's the typical career path for an RoR A/P ( from a PHP background or
> other)?
> If a CS grad, is it difficult to pick up - how long would you think it
> takes to become proficient?
> 
> Thanks in advance for any insights shared.
> 
> Deirdre

Firstly, it doesn't matter how well exploited the technology is because 
the support you (may) require for it can be done remotely. This includes 
hosting, of course. RoR already has an extensive community and a growing 
API, with support from major banking bodies and other industry-specific 
experts.

Secondly, A CS graduate is likely to have studied C of some variation 
and should, considering their assumed capabilities, be able to 
understand the structure of Ruby and the way in which it communicates 
with Rails.

Thirdly, may I ask why you have nominated the use of RoR? Surely, it 
would be better to let the Senior team decide which language is more 
suitable. I am asking this in spite of using RoR myself.
-- 
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] how to call a function after 10 minutes or second?

2010-06-16 Thread Vuong Hung
Hi all,

I have a problem.

I want to call some function after every 10 minutes. But I don't 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: Field validation

2010-06-16 Thread Pale Horse
Stanislav Orlenko wrote:
>
> Can I in some way check cost value in model (value should be numeral and
> integer)?
> 
> Thanks in advance!

validates_numericality_of?
-- 
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 get data from DOM Source other website?

2010-06-16 Thread Vuong Hung
Amar Daxini wrote:
> Vuong Hung wrote:
>> Hi, everybody.
>> 
>> I am newbie RoR.
>> 
>> I want to get all data from DOM Source of website.
>> 
>> Can you guide me the way to use REXML? I have ready installed lib-xml
>> library but I only use XML::Parser. I don't understant it.
>> 
>> Thanks a lot and looking forward.
> 
> Use Hpricot to parse Html/xml page which is much more easy.
> You can select particular data by finding unique css
> There are various options are available.
> Amar Daxini
> http://railstech.com

Thanks Amar Daxini,
I will try 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] Ruby on Rails Analyst/Programmers, Glasgow.

2010-06-16 Thread Deirdre Shell
Hi All,

I would like your advice.  I'm helping a young company set up a ROR team
from entry level to Senior A/P. I've not worked with this tech before so
have some basic questions.

What are your thoughts:
Is this a well exploited technology in Scotland/UK?
What's the typical career path for an RoR A/P ( from a PHP background or
other)?
If a CS grad, is it difficult to pick up - how long would you think it
takes to become proficient?

Thanks in advance for any insights shared.

Deirdre
-- 
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] Field validation

2010-06-16 Thread Stanislav Orlenko
Hi
I have a field called "cost":

<%= f.text_field :cost, :size=>2, :maxlength=>4 %>

I want to check that user enter numeral value and this value is integer

In post.rb (model):

def cost_validate_int
  errors.add_to_base("Error message") unless cost.is_a?(Fixnum)
  puts "### #{cost}: "+cost.class.to_s
end

When I enter in field 100 I get:

### 100: Fixnum

when I enter 10.1:

### 10: Fixnum

when I enter 'asdf':

### 0: Fixnum

I completely can't understand what happen. In migration:

t.integer :cost

I think ActiveRectord converts value to Fixnum because in migration this
field signed as integer

Can I in some way check cost value in model (value should be numeral and
integer)?

Thanks in advance!
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: before_filter exception being ignored

2010-06-16 Thread Pale Horse
The problem was that customer resource map in my routes file had no 
:only option specified. Problem solved.
-- 
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: Newbie trying to set up rails with MySQL

2010-06-16 Thread rtacconi
I did the same for XP, I installed 5.0

This link my give some additional help:
http://stackoverflow.com/questions/1557267/mysql-driver-for-rails-in-windows-7-x64

JRuby works without any problem (at least with XP) since is using the
Jdbc adapter, but probably you want to use C Ruby.

The problem is usually the dll and you could try this dll from
instantrails: 
http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/

As you know Ruby works better on Unix (Matz words) so if you can use
Ubuntu or a Mac. After many complaints, at work, I managed to get a
Mac and now I am really happy about my dev environment. If I where
still in Windows, probably now I would be using JRuby for sure.

On Jun 16, 7:51 am, Sharagoz  wrote:
> On Jun 15, 11:13 pm, Sarah Faulkner  wrote:> I'm on 
> Win7
>
> Last time I checked (which is at least 6 months ago now), the RoR
> mysql adapter and mysql 5.1 did not play well together on Vista/Win7.
> You may want to try version 5.0 before anything else.

-- 
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 get data from DOM Source other website?

2010-06-16 Thread Amar Daxini
Vuong Hung wrote:
> Hi, everybody.
> 
> I am newbie RoR.
> 
> I want to get all data from DOM Source of website.
> 
> Can you guide me the way to use REXML? I have ready installed lib-xml
> library but I only use XML::Parser. I don't understant it.
> 
> Thanks a lot and looking forward.

Use Hpricot to parse Html/xml page which is much more easy.
You can select particular data by finding unique css
There are various options are available.
Amar Daxini
http://railstech.com
-- 
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: redirect_to :controller=>'tips', :action => 'show'

2010-06-16 Thread Frederick Cheung


On Jun 11, 11:15 pm, John Useast  wrote:
>   hi,
>
> I tried to redirect rails to show action by passing controller, action,
> and params. However, rails ignores the name of action totally!
>
> what I got ishttp://mysite/controllername/paramId
>

With a normal set of restful routes (ie if you've got
map.resources :tips in your routes files), the normal show url for the
tip with id 123 IS /tips/123

Fred

> so i have error message
>
> here is the action code I used:
>
> def update
>     @tip = current_user.tips.find(params[:id])
>     @tip.attributes = params[:tip]
>     @tip.category_ids = params[:categories]
>     @tip.tag_with(params[:tags]) if params[:tags]
>
>     if @tip.save
>       flash[:notice] = 'Tip was successfully updated.'
>       redirect_to :controller=>'tips', :action => 'show', :id =>
> @tip.permalink
>     else
>       render :action => 'edit'
>     end
>   end
> --
> 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 at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Getting note only the class instances but also instances of subclasses on a has_many associations

2010-06-16 Thread gamov
I ran into problem when I wanted to mass assign via the association.
The class of the new object will be of the topclass.
The solution is here:
http://stackoverflow.com/questions/1601739/rails-attr-accessible-does-not-work-for-type

and in your form, use :type_helper


On Jun 16, 1:07 am, gamov  wrote:
> > Now the field_for method doesn't
> > see the charges in a form_for and I don't know why... I'm almost
> > there!
>
> Silly me, forgot the: accepts_nested_attributes_for :container_charges
>
> Well, it's hacky but it works. I'll report here if I run into other
> troubles because of this trick.
>
> Regards,
> Gam.

-- 
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: redirect_to :controller=>'tips', :action => 'show'

2010-06-16 Thread Amar Daxini
John Useast wrote:
> 
>   hi,
> 
> I tried to redirect rails to show action by passing controller, action,
> and params. However, rails ignores the name of action totally!
> 
> what I got is http://mysite/controllername/paramId
> 
> 
> def update
> @tip = current_user.tips.find(params[:id])
> @tip.attributes = params[:tip]
> @tip.category_ids = params[:categories]
> @tip.tag_with(params[:tags]) if params[:tags]
> 
> 
> if @tip.save
>   flash[:notice] = 'Tip was successfully updated.'
>   redirect_to :controller=>'tips', :action => 'show', :id =>
> @tip.permalink
> else
>   render :action => 'edit'
> end
>   end
you can try redirect_to(tip_path(@tip))

Amar Daxini
http://railstech.com
-- 
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: RoutingError

2010-06-16 Thread Amar Daxini
Aashish Kiran wrote:
> hi, can anyone help me. i want to create an url to invoke  create action
> of a controller. routes.rb has the routes. But i am getting error at
> line 23. i have @user variable.
> 
> user_contact_path(@user.id)
> I want generate url as : users/3/contacts to invoke contacts
> controller's create action
> 
> 
> -
> 
> ActionController::RoutingError in Contacts#index
> 
> Showing app/views/contacts/index.html.haml where line #23 raised:
> 
> user_contact_url failed to generate from {:controller=>"contacts",
> :user_id=>2, :action=>"show"}, expected: {:controller=>"contacts",
> :action=>"show"}, diff: {:user_id=>2}
> 
> Extracted source (around line #23):
> 
> 20: %p  or
> 21: %p Upload a vCard file to import people into your account.
> 22: %p
> 23:   - form_tag(user_contact_path(@user.id), :method => "post")
user has many contact and if it is nested you can use simply
form_tag([...@user,@contact])
It will works for creating contact under index action
In controller create @contact = @user.contacts.new

Try This,
Amar Daxini
Http://railstech.com

-- 
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: Store objects in sessions

2010-06-16 Thread Hans
My fault I did not realized that
My use vase is that I refactored some code as à service object.
That object is a parser and I would like to use the initialize methods
to
simplify the use of instance variables in different methods
As i understand your suggestion it would be ok to call a new instance
in each controller action

On 15 Juni, 16:16, Hassan Schroeder 
wrote:
> On Mon, Jun 14, 2010 at 11:10 PM, Hans Marmolin
>
>  wrote:
>
> > I have a non active revord object and i have to find an instance of that
> > object between requests
> > I have tried to save it in session but as the object uses Libxml i got the
> > error no marshall dump exists
> > I cannot make an active revord object as it is an object with no attributes
> > just methods
> > My solution is that not use an instance just The Class but then the code
> > becomes rather complex
> > So how to find an instance of that object between requests
>
> If it has "no attributes", then every instance is identical, yes? So why
> not instantiate a new one when you need it?
>
> I guess I'm having a hard time understanding your use case.
>
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
> twitter: @hassan

-- 
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: form select not saving to the database

2010-06-16 Thread Pale Horse
Marnen Laibow-Koser wrote:
> the batman wrote:
>> <%= f.label :type %>
>> <%= f.select(:type, ["original","print","other"]) %>
>> 
>> I have a photos model and added a drop-down list to the form, when the
>> option is selected, the correct parameters are passed but it is not
>> saved to the database.
>> I've googled this and looked at the api but I'm not sure what I'm doing.
>> In my photo model type is a string.
>> 
>> Is string the wrong field type? or anything else wrong?
> 
> Oh, disregard my earlier post.  I just realized what's going on.  Rails 
> reserves the field name "type" for STI purposes, and gets confused if 
> you try to use that name for an ordinary field.
> 
> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> mar...@marnen.org

I recently encountered this same problem. I simply changed the column to 
'category' and solved the problem. Though, it took far too long for me 
to realise this.
-- 
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: collection_select question

2010-06-16 Thread Pale Horse
Marnen Laibow-Koser wrote:
> Bee Dubya wrote:
>> Hello!
>> 
>> New to ruby on rails, so I hope this isn't a stupid question (great way
>> to start a post ;)). Basically I'm trying to avoid making a bunch of
>> different columns in my db table by having my collection_select
>> concatenate the ID value it returns to a single text field (for
>> instance, the collection_select will return a footnote ID, and I would
>> like to keep it in a job column called footnote) with comma's in between
>> because each job has multiple footnotes.
> 
> DO NOT DO THAT.  You need two tables with a has_many/belongs_to 
> relationship.  You should never ever put multiple values in one field.
> 
>> 
>> Is there any way I can accomplish this ? Ideally I would like to put
>> comma's in between so I can break it apart in another area of my
>> program.
> 
> Don't.  Read up on proper database normalization, and do it right.
> 
>> 
>> Thank you for any help.
> 
> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> mar...@marnen.org

In connection with this, and at the risk of reviving a dead thread: a 
big part of database normalisation is atomising your data. This enables 
you to better acclimate your application to future alterations and more 
effective database requests. Searching is a good example of this - I am 
simply reinforcing Marnen's point regarding database normalisation.
-- 
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: Different each iteration

2010-06-16 Thread Pale Horse
Greg Ma wrote:
> Hi,
> I've read a few days ago that rails has a each method that allows you to
> speficy the number of iteration. I think the default number was 1000.
> What is the name of the method?
> 
> myList.each_with_something or myList.each_something
> 
> Greg

You can specify the batch_size as an option to a find_each method. Batch 
methods should be used when your request retrieves large amounts of 
data:

"When processing large numbers of records, it's often a good idea to do 
so in batches to prevent memory ballooning."
-- 
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: database.yml host read from yml

2010-06-16 Thread Frederick Cheung


On Jun 14, 6:50 pm, Me  wrote:
> I have a yml file with ip info.  When I try to do " host:  Site['name']
> ['ip']  it is getting interpreted directly and it is saying Bad URI:
> Site['name']['ip']
>
> How do I get the database yml to interpret the Site constant?  I can
> see the hash in the console.

database.yml is passed through erb

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] Different each iteration

2010-06-16 Thread Michael Pavling
On 16 June 2010 09:19, Greg Ma  wrote:
> myList.each_with_something or myList.each_something

Do you mean the "each_slice" method of enumerable?

http://ruby-doc.org/core/classes/Enumerable.html

-- 
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] Learning RoR

2010-06-16 Thread Ivan Nastyukhin
http://guides.rubyonrails.com/
hi, its will be help u)
Ivan Nastyukhin
dieinz...@me.com






On Jun 16, 2010, at 3:13 AM, Ryan Kneer wrote:

> Hey.  I'm just getting into RoR and was hoping someone could direct me
> to the best learning resources.
> 
> P.S.: I took a couple computer sciences courses in university (learned
> some Java and C++).
> 
> Cheers,
> Ryan
> 
> -- 
> 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 authentication from non-web interface

2010-06-16 Thread Vaswani
Yeah, I am working on exactly similar project and using http basic
auth over https.
Though what is the best way to disable cookies and session management
in rails as these are not required
in the above approach.

Thanks
Gopal

On Jun 15, 4:45 am, Rick DeNatale  wrote:
> On Mon, Jun 14, 2010 at 8:12 AM, Joshua Partogi
>
>  wrote:
> > Hi all,
>
> > I want to authenticate my mobile phone apps to my online Rails apps.
> > What would be the best approach to do this? Can anybody give
> > suggestion both on how I should do it in the mobile app and in the
> > rails app?
>
> I'd set the rails app to accept http basic authorization over https,
> and have the mobile app store the user's password.
> --
> Rick DeNatale
>
> Blog:http://talklikeaduck.denhaven2.com/
> Github:http://github.com/rubyredrick
> Twitter: @RickDeNatale
> WWR:http://www.workingwithrails.com/person/9021-rick-denatale
> LinkedIn:http://www.linkedin.com/in/rickdenatale

-- 
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: RoutingError

2010-06-16 Thread Agoofin
What do you have in your routes.rb file to setup the custom route?

http://guides.rubyonrails.org/routing.html

On Jun 15, 11:27 am, Aashish Kiran  wrote:
> hi, can anyone help me. i want to create an url to invoke  create action
> of a controller. routes.rb has the routes. But i am getting error at
> line 23. i have @user variable.
>
> user_contact_path(@user.id)
> I want generate url as : users/3/contacts to invoke contacts
> controller's create action
>
> -
>
> ActionController::RoutingError in Contacts#index
>
> Showing app/views/contacts/index.html.haml where line #23 raised:
>
> user_contact_url failed to generate from {:controller=>"contacts",
> :user_id=>2, :action=>"show"}, expected: {:controller=>"contacts",
> :action=>"show"}, diff: {:user_id=>2}
>
> Extracted source (around line #23):
>
> 20:         %p  or
> 21:         %p Upload a vCard file to import people into your account.
> 22:         %p
> 23:           - form_tag(user_contact_path(@user.id), :method => "post")
> do
> 24:             = file_field_tag "file"
> 25:             = submit_tag
> 26:     .span_2
> 
>
> thank you,
> aashish
> --
> 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 at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Learning RoR

2010-06-16 Thread Ryan Kneer
Hey.  I'm just getting into RoR and was hoping someone could direct me
to the best learning resources.

P.S.: I took a couple computer sciences courses in university (learned
some Java and C++).

Cheers,
Ryan

-- 
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] Different each iteration

2010-06-16 Thread Ivan Nastyukhin
does u speak about it ? 
http://api.rubyonrails.org/classes/ActiveRecord/Batches/ClassMethods.html

Ivan Nastyukhin
dieinz...@me.com






On Jun 16, 2010, at 12:19 PM, Greg Ma wrote:

> Hi,
> I've read a few days ago that rails has a each method that allows you to
> speficy the number of iteration. I think the default number was 1000.
> What is the name of the method?
> 
> myList.each_with_something or myList.each_something
> 
> Greg
> -- 
> 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] modifying an association during inheritance

2010-06-16 Thread Chris Kilmer
I have a Team class that inherits from a Group class.  Both Team and
Groups have memberships through the same association.  However, I need
to run a method after a Team memberships is added but not a Group.  I
currently have something like this:

class Group < ActiveRecord::Base
  has_many :memberships,
   :class_name => 'Connection',
   :foreign_key => 'connectable_id',
   :as => :connectable,
   :dependent => :destroy
end

class Team < Group
  has_many :memberships,
   :class_name => 'Connection',
   :foreign_key => 'connectable_id',
   :as => :connectable,
   :dependent => :destroy,
   :after_add => :add_company_membership

private
   def membership_check(membership)
   end
end

Is there some way to modify the inherited association in Team so that
I don't have to redefine the entire thing but rather just add
the :after_add hook it?

Any help would be appreciated.

-- 
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] Different each iteration

2010-06-16 Thread Greg Ma
Hi,
I've read a few days ago that rails has a each method that allows you to
speficy the number of iteration. I think the default number was 1000.
What is the name of the method?

myList.each_with_something or myList.each_something

Greg
-- 
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: before_filter exception being ignored

2010-06-16 Thread Pale Horse
Mamadou Touré wrote:

> Hello,
> 
> Could we have a look on your .rhtml, to make sure that the action that is 
> triggered by the link is the good one ?

customers/forgotten_password.html.erb: http://pastie.org/1006510

customer_sessions/new.html.erb: http://pastie.org/1006513
-- 
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] I installed rails 3 and how to install rails 2

2010-06-16 Thread Ivan Nastyukhin
simplify - u can use rvm or create link to /rails-2.3.8/bin/rails 
some thinks like this to /usr/local/bint/rails2 

Ivan Nastyukhin
dieinz...@me.com






On Jun 16, 2010, at 11:02 AM, karnati kiran wrote:

> Hi all,
> 
> i installed rails 3 and how to install rails 2 in the  same machine please 
> help me
>  
> 
> 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.

-- 
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] Routing Error in rails 3.0

2010-06-16 Thread Ivan Nastyukhin
hi
show your routes please

Ivan Nastyukhin
dieinz...@me.com






On Jun 16, 2010, at 10:31 AM, karnati kiran wrote:

> Hi All,
> 
> 
> $rails g controller Pages home contact
> 
> then, I go to http://localhost:3000/pages/home
> 
> I got
> 
> Routing Error
> 
> No route matches "/pages/contact"
> 
> 
> How can I fix this problem?
> 
> 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.

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



  1   2   >