[Rails] Keeping Admin Code Seperate

2008-10-08 Thread cyrusdev08


Hello All,

Can anybody suggest me in rails how to keep admin code seperate  from
front 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-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Serving a PDF document

2008-10-08 Thread Simon Macneall

Hi all,

Been banging my head against this for a little while so figured I see if  
anyone here could light the way.

Our site receives input from fillable pdfs as XML (XFDF to be precise) and  
processes the information. We also need to be able to re-export the filled  
PDF. To do this you send the xfdf file with an href to the original pdf  
document.

If I point the href to a static PDF (so, put it in the public folder)  
adobe opens and fills the pdf correctly. However, if I point to the pdf  
using a dynamic URL to rails then Adobe just doesn't fill the pdf.

So my question, what is the difference between
http://localhost:3000/pdfs/TACServiceReport0908.pdf - where pdfs is a  
folder in the public folder of the app
and
http://localhost:3000/forms/show/4.pdf - this renders the exact same file  
using one of the following (I have tried them all)

send_file(@form.pdf_filename, :type => 'application/pdf', :dispoisition =>  
'attachment')
send_file(@form.pdf_filename, :type => 'application/pdf', :dispoisition =>  
'inline')
send_data(content, :filename => filename, :type => "application/pdf",  
:disposition => "inline")
send_data(content, :filename => filename, :type => "application/pdf",  
:disposition => "attachment")

and how can I make the second method behave like the first.


Thanks
Simon

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



[Rails] Re: ActiveRecord (2.1.1) and time columns

2008-10-08 Thread Jacob Patton

On Sep 21, 2:17 pm, Frederick Cheung <[EMAIL PROTECTED]>
wrote:

> Ruby doesn't have a pure time of day class. If you're database have  
> time columns then what you get back is a Time object for 1st January  
> 2000 and the appropriate time.

Yes, that's what it looks like from my end.  I ultimately decided to
leave in the date + time concatenation in my named scopes to handle
databases with & without time columns.

(Sorry for the late post -- I didn't have a chance to post back before
going on vacation.)

Jacob

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



[Rails] No Method Error when using a plugin

2008-10-08 Thread dangerp

I'm at kind of a weird roadblock right now.  I'm fairly new at rails,
but what I am trying to do right now seems too simple to not work.  I
installed the "spawn" plugin using the following:

 ruby script/plugin install http://spawn.rubyforge.org/svn/spawn

I verified that the plugin was properly installed into vendor/plugins/
spawn.  I tried using the code snippets that the author provided:

spawn do
logger.info("I feel sleepy...")
sleep 11
logger.info("Time to wake up!")
  end

and I get the error: undefined method "spawn".  From what I
understand, since it is in the plugins directory, I do not need to
require or otherwise initialize this plugin (although I did try
requiring it).  I am getting the same error in my application and when
using 'ruby script/console'

I don't see what I am doing wrong.  Does anyone have any ideas?

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



[Rails] Re: How to let a user render a partial?

2008-10-08 Thread David Trasbo

David Trasbo wrote:

>> as a quick example, this
>> 
>> require 'strscan'
>> s = StringScanner.new('blah {some_partial arg1:foo arg2:bar} other
>> stuff here {otherpartial arg1:baz}')
>> 
>> while s.scan_until /\{/
>>puts "start of call"
>>puts s.scan /\w+/
>>s.skip /\s+/
>>while  output=s.scan( /\w+:\w+/)
>>  puts output
>>  s.skip /\s+/
>>end
>>s.skip_until /\}/
>>puts "end of call"
>> end

...

> This looks just great! I'll return when I've written a complete method.

Okay, I've been taking a look at this, and I'm facing a problem. When 
I've scanned a string I want to actually replace all the {some_partial 
foo:bar}'s with partial renderings.

I've been looking through the StringScanner documentation 
(http://www.ruby-doc.org/core/classes/StringScanner.html), but it 
doesn't seem to cover the topic of replacing matches instead of just 
extracting it, if you know what I mean.

How can I replace a {some_partial foo:bar} match with a partial 
rendering?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: How to let a user render a partial?

2008-10-08 Thread David Trasbo

Frederick Cheung wrote:

>> get the regular expression right. It needs to respect multiple
>> arguments. Any suggestions?
> 
> that's the point - with stringscanner you don't need to come up with
> one giant regular expression that gets everything right

Aha! I thought you meant the RegExp#scan method.

> as a quick example, this
> 
> require 'strscan'
> s = StringScanner.new('blah {some_partial arg1:foo arg2:bar} other
> stuff here {otherpartial arg1:baz}')
> 
> while s.scan_until /\{/
>puts "start of call"
>puts s.scan /\w+/
>s.skip /\s+/
>while  output=s.scan( /\w+:\w+/)
>  puts output
>  s.skip /\s+/
>end
>s.skip_until /\}/
>puts "end of call"
> end
> 
> outputs
> 
> start of call
> some_partial
> arg1:foo
> arg2:bar
> end of call
> start of call
> otherpartial
> arg1:baz
> end of call

This looks just great! I'll return when I've written a complete method.

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

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



[Rails] Re: passenger dedicated server

2008-10-08 Thread fRAnKEnSTEin

Hi,

>Maybe you should define /exactly/ what you mean by "dedicated server"

Well i mean that i have full root access to all accounts on the
server. And that i can install, delete, update etc in any way i want
to. Only my apps are installed and running , i have all the power over
the server, this is what i mean with "dedicated server"

>I was installing on my OS X system -- just another *nix box. A server is a
server is a server. Because you installed server software on it :-)

I already installed passenger on my MAC, and it works, but that is
obius, because my MAC:

1- Is a local eviroment, that means that all the installations are
donde like root, and more important with a very low security
configuration(my mac is a testing eviroment not a production one)

2- As a local machine, is a testing eviroment, so it does not have any
high securiity, firewalls, special users and all that stuff that a
real production server has and that usually make things harder to
install and configure, for a simple example i connect in my local
machine to mysql using user root with no password, but in a real
producction eviroment this can not be done, so i have not to deal with
this stuff when installing something in my *nix local machine :),
thats why passenger was easy to install :-)

>Maybe you should do a test install on another system where you aren't 

>wrestling with "cpanel" to validate the basic process.

the cpanel stuff was just an example, i am not sure if it is the
cpanel who causes the problem, i was just giving an example that in a
production eviroment exists a lot of "extra" thing that are
configurated different and that may cause tha passenger install not so
easy to do, maybe cpanel, maybe some chmod problems, maybe some lost
symbolic links problems etc

>What company did you get your dedicated server from

www.jaguarpc.com

>Most dedicated
servers has the ability to be installed without a control panel and
most of the time it is easier to do custom installs like pasanger/
mongrel or other without a control panel like cpanel

of course, as i said before i have installed passenger already, the
problem i got is that i can not configure it properly using just the
instructions that passenger installing process gives

>did you install wget on the server (yum install wget) and/or links 
(yum 
>install links) this will let you "test" from the local server to 
see if 
>everything is working fine there before testing outside

i have installed many software using yum, and wget was already
installed when i buyed the dedicaded server, and both work just fine

>AND THE BIG QUESTION! IS THE CPANEL FIREWALL OPEN

I am not sure, but is this important for passenger to work properly?

Thanks for your support,

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



[Rails] Re: redirecting to uploaded files directory

2008-10-08 Thread sal

ack!

I meant to type same controller name as the default directory
attachment_fu creates; I get a server listing of files instead of the
index of that resource.

my bad.

any thoughts?

On Oct 8, 10:50 pm, sal <[EMAIL PROTECTED]> wrote:
> All,
>
> I'm running into a bit of a newb issue here. I've created an app with
> attachment_fu which by default created a directory within public as
> "public/#{tablename}". But now when I try and browse to my default
> action for that resource which is the same actionname as my tablename
> I get redirected to a file listing of that public/tablename
> directory... within my index view of that action I want to display the
> file I've uploaded but I cannot figure out why it's redirectiing to
> the files directory attachment_fu has uploaded the file to. not sure
> if this is a webserver (apache/passenger) or a rails routing issue...
>
> hope that makes sense
>
> can anyone please help?
>
> thanks in advance
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: HABTM & Many through association.

2008-10-08 Thread RoR_Nb

that's basically going above rails, using mysql where clause
but with rails:

  def tagging=(tagging)
self.tags.each do |tag|
  tag.destroy unless tagging.include? (tag[:technology_id].to_s)
end
tagging.each do |tag|
  tags.build(:technology_id => tag) unless tags.any?{|t|
t.technology_id.to_i == tag.to_i}
end
  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-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: passenger dedicated server

2008-10-08 Thread Freddy Andersen

What company did you get your dedicated server from? Most dedicated
servers has the ability to be installed without a control panel and
most of the time it is easier to do custom installs like pasanger/
mongrel or other without a control panel like cpanel. cpanel is a
great tool if all you want is a few static pages (that is MY take
btw.)

When you got your domain you set that up in DNS to point to your
dedicated servers ip.

www.your-domain.com -> A record -> 1.1.1.1 (dedicated server ip)

Then you have to configure Apache to listen for www.your-domain.com if
you have virtualhosts setup. (If you only have one that will be the
default host and should work anywho... )

You should be able to see entries in the apache logs if you hit the ip
address.

Btw did you install wget on the server (yum install wget) and/or links
(yum install links) this will let you "test" from the local server to
see if everything is working fine there before testing outside...

AND THE BIG QUESTION! IS THE CPANEL FIREWALL OPEN

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



[Rails] Re: passenger dedicated server

2008-10-08 Thread Hassan Schroeder

On Wed, Oct 8, 2008 at 9:20 PM, fRAnKEnSTEin <[EMAIL PROTECTED]> wrote:

> This system that you have installed passenger, was a dedicated server?

Maybe you should define /exactly/ what you mean by "dedicated server".
I was installing on my OS X system -- just another *nix box. A server is a
server is a server. Because you installed server software on it :-)

Maybe you should do a test install on another system where you aren't
wrestling with "cpanel" to validate the basic process.

> if yes, dou you just follow the passenger installation
> instructions(i.e copy-paste the lines into http.conf), and just with
> that it works properly for you?

Yep.

> the name of the virtualhost
> must be the same as the domain name that i buyed?

Well, yeah, that's basic name-based virtual hosting :-)

HTH,

H*
-- 
Hassan Schroeder  [EMAIL PROTECTED]

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



[Rails] redirecting to uploaded files directory

2008-10-08 Thread sal

All,

I'm running into a bit of a newb issue here. I've created an app with
attachment_fu which by default created a directory within public as
"public/#{tablename}". But now when I try and browse to my default
action for that resource which is the same actionname as my tablename
I get redirected to a file listing of that public/tablename
directory... within my index view of that action I want to display the
file I've uploaded but I cannot figure out why it's redirectiing to
the files directory attachment_fu has uploaded the file to. not sure
if this is a webserver (apache/passenger) or a rails routing issue...

hope that makes sense

can anyone please help?

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



[Rails] How to use Rails' exception handling mechanism in a background thread?

2008-10-08 Thread Myron Marston

I have some simple asynchronous processing that my app needs to do,
and I wanted something a bit lighter weight than any of the gems or
plugins I've run across that handle background processing.  I decided
to roll my own, with the added benefit that I get to use native
threads rather than green threads since I'm using JRuby.

I'm unsure how to handle exceptions in the background thread. I'd like
to pass it to Rails' exception handling mechanism so that it is dealt
with in the same way as exceptions that occur during the normal
request-response cycle (except for rendering the 500 page, of
course).  Since I've got the exception notifier plugin installed, this
would email me, as well as log the exception to the log file.

Is there a way to let Rails handle the exception, where whatever
exception handling I have in my rails app would get used for
exceptions in the background thread?

In case it helps, I've included the code for my background thread
below.

Thanks,
Myron


class UserSubmissionProcessor
  SLEEP_TIME = 30 unless defined? SLEEP_TIME
  @@semaphore = Mutex.new
  @@singleton_thread = nil unless defined? @@singleton_thread

  def self.start_processor_if_necessary
@@semaphore.synchronize do
  if @@singleton_thread.nil?
@@singleton_thread = Thread.new
{UserSubmissionProcessor.process}
  end
end
  end

  private

  def self.process
while true
  begin
user_submission = UserSubmission.find(:first, :conditions =>
{:processing_completed => nil}, :order => 'created_at')

if user_submission
  user_submission.process
else
  sleep SLEEP_TIME
end
  rescue Exception => ex
#TODO: how to I propagate exceptions to rails' exception-
handling mechanism?
  end
end
  end
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-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: passenger dedicated server

2008-10-08 Thread fRAnKEnSTEin

Hi,

> I just installed passenger/mod_rails on a system yesterday for the
> first time, and it took about 5 minutes. It sounds like your problem
> is with cpanel, not passenger.

This system that you have installed passenger, was a dedicated server?
if yes, dou you just follow the passenger installation
instructions(i.e copy-paste the lines into http.conf), and just with
that it works properly for you? did not configure any etc/hosts file
or anything else? how do you access the rails app, something like
"http://www.mydomain.com"; where "www.mydomain.com" is the name of the
virtual host you put in in the htp.conf? the name of the virtualhost
must be the same as the domain name that i buyed?

Regards,

Mohammed


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



[Rails] Re: HABTM & Many through association.

2008-10-08 Thread RoR_Nb

I think the reason is because you need to build the data in memory
because in the moment "def tagging=(tagging)" method setter is run the
blog has not been created and that's why it should go in memory.

On Oct 8, 6:00 pm, RoR_Nb <[EMAIL PROTECTED]> wrote:
> Lovely
>
> This might be a php solution but it works:
>
> def tagging=(tagging)
>     Tag.delete_all "technology_id not in (" + tagging.to_s + ") and
> blog_id = " +self.id.to_s
>     tagging.each do |tag|
>       self.tags.create(:technology_id => tag) unless tags.any?{|t|
> t.technology_id.to_i == tag.to_i}
>     end
>   end
>
> On Oct 7, 2:33 pm, RoR_Nb <[EMAIL PROTECTED]> wrote:
>
> > It did remove the mysql error thanks a lot guys.
> > but there's still a problem, and what happens is
> > that if i have 2 tags selected and then i unchecked 1 then it deletes
> > both,
> > maybe it has to do with the code. but i guess it's my login what's not
> > working,
> > is that correct?.
>
> > I'll work on that and if i find a solution i'll post it here for
> > future other people to see it.
>
> > On Oct 7, 3:33 am, Frederick Cheung <[EMAIL PROTECTED]>
> > wrote:
>
> > > On 6 Oct 2008, at 07:43, RoR_Nb wrote:
>
> > > > I know i don't have an id for the join table
>
> > > With has_many :through, the join table is a model in its own right and  
> > > needs a promary key
>
> > > Fred
>
> > > > class CreateTags < ActiveRecord::Migration
> > > >  def self.up
> > > >    create_table :tags, :id => false do |t|
> > > >      t.integer :blog_id
> > > >      t.integer :technology_id
> > > > ..
> > > >  end
> > > > end
>
> > > > How can i solve this problem?
> > > > thanks in advanced
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: HABTM & Many through association.

2008-10-08 Thread RoR_Nb

The previous code fails when creating new blog this works

def tagging=(tagging)
Tag.delete_all "technology_id not in (" + tagging.to_s + ") and
blog_id = " +self.id.to_s unless self.new_record?
tagging.each do |tag|
  tags.build(:technology_id => tag) unless tags.any?{|t|
t.technology_id.to_i == tag.to_i}
end
  #  Tag.delete_all "technology_id not in (" + tagging.to_s + ") and
blog_id = " +self.id.to_s unless self.new_record?
  #  tagging.each do |tag|
  #self.tags.create(:technology_id => tag) unless tags.any?{|t|
t.technology_id.to_i == tag.to_i}
  #  end
end

It seems php but it works

On Oct 8, 6:00 pm, RoR_Nb <[EMAIL PROTECTED]> wrote:
> Lovely
>
> This might be a php solution but it works:
>
> def tagging=(tagging)
>     Tag.delete_all "technology_id not in (" + tagging.to_s + ") and
> blog_id = " +self.id.to_s
>     tagging.each do |tag|
>       self.tags.create(:technology_id => tag) unless tags.any?{|t|
> t.technology_id.to_i == tag.to_i}
>     end
>   end
>
> On Oct 7, 2:33 pm, RoR_Nb <[EMAIL PROTECTED]> wrote:
>
> > It did remove the mysql error thanks a lot guys.
> > but there's still a problem, and what happens is
> > that if i have 2 tags selected and then i unchecked 1 then it deletes
> > both,
> > maybe it has to do with the code. but i guess it's my login what's not
> > working,
> > is that correct?.
>
> > I'll work on that and if i find a solution i'll post it here for
> > future other people to see it.
>
> > On Oct 7, 3:33 am, Frederick Cheung <[EMAIL PROTECTED]>
> > wrote:
>
> > > On 6 Oct 2008, at 07:43, RoR_Nb wrote:
>
> > > > I know i don't have an id for the join table
>
> > > With has_many :through, the join table is a model in its own right and  
> > > needs a promary key
>
> > > Fred
>
> > > > class CreateTags < ActiveRecord::Migration
> > > >  def self.up
> > > >    create_table :tags, :id => false do |t|
> > > >      t.integer :blog_id
> > > >      t.integer :technology_id
> > > > ..
> > > >  end
> > > > end
>
> > > > How can i solve this problem?
> > > > thanks in advanced
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: strange observe_field/partial functioning..

2008-10-08 Thread Jay Pangmi

Frederick Cheung wrote:
> On 8 Oct 2008, at 15:56, Jay Pangmi wrote:
> 
> Find out exactly why it is not working and you will be well on your
> way to fixing it.
> 
> Fred

I'm trying to find out why?? but I don't think I can. Until now what 
I've found is that the Firefox showing errors in its error console is 
from the default javascripts files of which prototype.js I tried to 
trace the problem as it was saying ')' is missing on some number line. 
So, i went there but found everything is fine. ')' is there. Also, the 
line giving error from my code is:

new Form.Element.EventObserver('great_walks', function(element, value)
{new Ajax.Updater('campsites_list', '/user/update_campsites',
{asynchronous:true, evalScripts:true, parameters:'id=' + value +
'&authenticity_token=' +
encodeURIComponent('596f343332f1b5ff9a9bcd36fe9545a71a293677')})})

but according to api docs, observe_field generates similar line only. 
Firefox says 'form is not defined' and highlights this line. I don't 
know what to do.. please suggest... 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-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: passenger dedicated server

2008-10-08 Thread Hassan Schroeder

On Wed, Oct 8, 2008 at 6:28 PM, fRAnKEnSTEin <[EMAIL PROTECTED]> wrote:

> I am trying to install/configure Passenger on a dedicated centos
> server. I have installed passenger successfully, but i am having to
> much troubles trying to configure it with my dedicated server

> First of all, my dedicated server uses cpanel, this means that i can
> not just open directly the http.donf file to make changes because
> cPanel rebuilds the file on every update or account creation by
> compiling from its userdata files.

If it's a "dedicated server", you should be able to configure it any
way you want -- so why don't you turn off this "cpanel" thing, which
sounds like total crap, and edit your conf files as needed?

I just installed passenger/mod_rails on a system yesterday for the
first time, and it took about 5 minutes. It sounds like your problem
is with cpanel, not passenger.

Just sayin' ... :-)

-- 
Hassan Schroeder  [EMAIL PROTECTED]

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



[Rails] Re: Polymorphic Associations in Rails 2 not configurable

2008-10-08 Thread Aryk Grosz

Thanks for the input,

I wouldnt say this is exactly a complicated example. Its basically where 
you could infer the polymorphic class from STI type sort of thing. Im 
pretty sure many other people run into it.

The bottom line is that there is no customizablility.

The problem is that the code has sql strings generated with 
"#{variable}_type = X which makes it very hard to replace with a 
function to control the outputted polymorphic sql condition.

I wonder if there is anybody else that has run into the same problems.


Maurício Linhares wrote:
> Well, that's definitely a "complicated" example :)
> 
> I guess you should try to figure out with the core rails guys where
> you could hack the code to do just that (what would be infer the name
> of the real association from something else), i haven't looked at the
> code myself, but it shouldn't be that hard with the right guidance.
> 
> Also, if you want to roll your own solution, it isn't that hard and
> there's also plenty of work already written about the matter, one of
> the best options is Martin Fowler's "Patterns of Enterprise
> Application Architeture" (
> http://martinfowler.com/eaaCatalog/index.html ), there are 3 sections
> about object-relational mapping tool structure.
> 
> On Wed, Oct 8, 2008 at 1:30 AM, Aryk Grosz
> <[EMAIL PROTECTED]> wrote:
>>
>> So, now I need a "detail_type" column of "BookDetail" or in other words
>> "#{product_type.classify}Detail".
>>
>> Now I have two extra string columns that are not needed and are making
>> things much less DRY.
>>
>> Aryk
> 
> 
> 
> --
> Maur�cio Linhares
> http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ 
> (en)
> Jo�o Pessoa, PB, +55 83 8867-7208

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

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



[Rails] Re: updating attribute in model

2008-10-08 Thread Allen Walker

Philip Hallstrom wrote:
>> end
>>
>> I'm getting a "stack level too deep error". Any suggestions on how to
>> fix and the correct approach to this.
> 
> You're calling status from within status so it's recursing forever.
> 
> Replace that last status with read_attribute(:status) after perhaps
> reloading the object to ensure you've got the latest.

Yeah that is was. Simple calling

'read_attribute(:status)' instead of 'status' did the trick. 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-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: updating attribute in model

2008-10-08 Thread Maurício Linhares

Hi Allen,

I'm not sure, but this seems to be a before or after save filter, if
it's before_save, instead of update_attribute, just call
write_attribute, when the model is saved it will automatically save
this new value, if it's an after filter, make it a before one.

On Wed, Oct 8, 2008 at 11:09 PM, Allen Walker
<[EMAIL PROTECTED]> wrote:
>
> I'm trying to make a change to a field in the model whenever someone
> accesses it and it's incorrect. So I have the following in my
> ActiveRecord class:
>
> def status
>  prev_status = read_attribute(:status)
>  if end_date < Date.today
>update_attribute(:status, "Expired")
>  end
>  status
> end
>
> I'm getting a "stack level too deep error". Any suggestions on how to
> fix and the correct approach to this.
>
> thanks
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>



-- 
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)
João Pessoa, PB, +55 83 8867-7208

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



[Rails] Re: How to install rubygem-cobbler

2008-10-08 Thread Nikki

Thanks,amrita!  :-)
You indeed give a prompt help. :-)

On Oct 9, 6:32 am, amrita <[EMAIL PROTECTED]> wrote:
> Try running a `gem help commands`. You will get an overview of all
> things you can do with gem.
>
> Then you can do a `gem help sources` which gives the following :-)
>
> Usage: gem sources [options]
>
>   Options:
>     -a, --add SOURCE_URI             Add source
>     -l, --list                       List sources
>     -r, --remove SOURCE_URI          Remove source
>     -c, --clear-all                  Remove all sources (clear the
> cache)
>     -u, --update                     Update source cache
>
>   Common Options:
>     -h, --help                       Get help on this command
>     -V, --[no-]verbose               Set the verbose level of output
>     -q, --quiet                      Silence commands
>         --config-file FILE           Use this config file instead of
> default
>         --backtrace                  Show stack backtrace on errors
>         --debug                      Turn on Ruby debugging
>
>   Summary:
>     Manage the sources and cache file RubyGems uses to search for gems
>
>   Defaults:
>     --list
>
> Now you can add/remove any repositories from your gem sources.
>
> On Oct 7, 10:40 pm, Nikki <[EMAIL PROTECTED]> wrote:
>
> > Thank you for your feedback! :)
> > I have resolved my problem.
> > After installing the cobbler rpm ,run "rpm -ql rubygem-cobbler",and
> > the first line gives the path of rubygem-cobbler.
> > Then run "gem install cobbler path --include-denpendencies".
>
> > Another question:
> > Could you please give me some details about changing gem repository?
>
> > Thanks,
>
> > Nikki
> > On Oct 8, 2:56 am,amrita<[EMAIL PROTECTED]> wrote:
>
> > > You could use
>
> > > gem install cobbler --source  --include-dependencies
>
> > > where url points to the source of the cobbler gem. Make sure you have
> > > installed gem first.
>
> > > Alternately you could add the repository from where you would like gem
> > > to pull out cobbler, to the gem sources. After that do a `gem env`
> > > just to make sure that the repository is among the sources. After that
> > > running `gem install cobbler` should work.
>
> > > On Oct 6, 11:57 pm, Nikki <[EMAIL PROTECTED]> wrote:
>
> > > > Hi ALL,
> > > >   I am newcomer and also a freshman to Ruby.
> > > >   Would anyone have the experience about installing rubygem-cobbler?
> > > >   I tried to run some ruby programs.It prompts "Could not find Ruby
> > > > Gem cobbler(>= 0)(Gem::LoadError)".But I had tried "yum install" and
> > > > to download cobbler files.They all don't work.
> > > >   Would anyone give some advice?
> > > >   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-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: updating attribute in model

2008-10-08 Thread Philip Hallstrom

> I'm trying to make a change to a field in the model whenever someone
> accesses it and it's incorrect. So I have the following in my
> ActiveRecord class:
>
> def status
>  prev_status = read_attribute(:status)
>  if end_date < Date.today
>update_attribute(:status, "Expired")
>  end
>  status
> end
>
> I'm getting a "stack level too deep error". Any suggestions on how to
> fix and the correct approach to this.

You're calling status from within status so it's recursing forever.

Replace that last status with read_attribute(:status) after perhaps  
reloading the object to ensure you've got the latest.

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



[Rails] updating attribute in model

2008-10-08 Thread Allen Walker

I'm trying to make a change to a field in the model whenever someone
accesses it and it's incorrect. So I have the following in my
ActiveRecord class:

def status
  prev_status = read_attribute(:status)
  if end_date < Date.today
update_attribute(:status, "Expired")
  end
  status
end

I'm getting a "stack level too deep error". Any suggestions on how to
fix and the correct approach to this.

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



[Rails] Re: Polymorphic Associations in Rails 2 not configurable

2008-10-08 Thread Maurício Linhares

Well, that's definitely a "complicated" example :)

I guess you should try to figure out with the core rails guys where
you could hack the code to do just that (what would be infer the name
of the real association from something else), i haven't looked at the
code myself, but it shouldn't be that hard with the right guidance.

Also, if you want to roll your own solution, it isn't that hard and
there's also plenty of work already written about the matter, one of
the best options is Martin Fowler's "Patterns of Enterprise
Application Architeture" (
http://martinfowler.com/eaaCatalog/index.html ), there are 3 sections
about object-relational mapping tool structure.

On Wed, Oct 8, 2008 at 1:30 AM, Aryk Grosz
<[EMAIL PROTECTED]> wrote:
>
> Sure Mauricio, here's an example.
>
> Lets say you have a "products" table. You have product_type table column
> in that table that you use for single table inheritance. So lets say you
> have the value "book" as the product_type.
>
> Now you want to have a  pricing for this product, so you do:
>
>  belongs_to :pricing, :polymorphic => true
>
> So now you need a pricing_type with a class name of "BookPricing", or in
> other words "#{product_type.classify}Pricing". You will always follow
> this convention since I wouldnt have BookPricing for a product_type of
> "poster"
>
> But wait! There's more. Now I want another polymorphic association for
> "details" for that product. So I do:
>
>  belongs_to :detail, :polymorphic => true
>
> So, now I need a "detail_type" column of "BookDetail" or in other words
> "#{product_type.classify}Detail".
>
> Now I have two extra string columns that are not needed and are making
> things much less DRY.
>
> Aryk



-- 
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)
João Pessoa, PB, +55 83 8867-7208

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



[Rails] Re: display a form with selected values from URL

2008-10-08 Thread robertderosny

I've managed to do it the old way using /books/new?author_id=
and
@author = Author.find(params[:author_id])
@book = @author.books.new
 as you've suggested.

thanks again.


On 9 oct, 02:48, robertderosny <[EMAIL PROTECTED]> wrote:
> thanks for your help
>
> /authors/3/books/new gives me a
>
> Routing Error
> No route matches "/authors/3/books/new" with {:method=>:get}
>
> I guess i need to update my routes.rb for this to work ?
>
> i've tried this :
>
> map.resources :books, :path_prefix => "/authors/:author_id"
>
> without success ..
>
> if that helps : i'm using rails 2 with REST.
>
> On 8 oct, 19:26, Freddy Andersen <[EMAIL PROTECTED]> wrote:
>
> > Two ways the good and the bad :
>
> > Good:
>
> > url:
> > /author/1/book/new
>
> > BookController
> > new
> > @author = Author.find(params[:author_id])
> > @book = @author.books.new
>
> > or (not so good)
>
> > BookController
>
> > @author = Author.find(params[:author])
> > @book = Book.new
> > @book.author = @author
>
> > Should work too...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: new controller actions and url_for

2008-10-08 Thread Maurício Linhares

What you want is a collection, not a member:

map.resource :species, :collection => { :list => :get }

Also, instead of using url_for, you could use list_species_path( :sort
=> key, :page => nil )

On Wed, Oct 8, 2008 at 8:40 PM, amrita <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I just defined a new controller action "list" for one of my
> controllers, let's call it "species". To routes.rb, I added the
> following entry:
>
> map.resource :species, :member => { :list => :get }
>
> I have a helper method in which I use url_for as follows:
>
> url_for(:controller => 'species', :action => 'list', :params =>
> params.merge({:sort => key, :page => nil}))
>
> When I call this helper method from the view, it completely bypasses
> the action in the generated URL. I get a URL as follows:
>
> http://myserver.mydomain.org:8080/species?sort=sortparam
>
> What I expect to get is a URL as follows:
>
> http://myserver.mydomain.org:8080/species/list?sort=sortparam
>
> I did a `rake routes | grep list` and I do get the following two
> lines:
>
> list_species GET/species/
> list
> {:controller=>"species", :action=>"list"}
> formatted_list_species GET/species/
> list.:format
> {:controller=>"species", :action=>"list"}
>
> Could someone please point out what needs to be corrected for url_for
> to work properly? Is url_for not finding a route for
> controller=species and action=list or is there some other problem?
>
>
> Many thanks!
> Amrita
> >
>



-- 
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)
João Pessoa, PB, +55 83 8867-7208

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



[Rails] Re: :find conditions using hour value of saved DateTime object

2008-10-08 Thread Maurício Linhares

Ideally, you should save this in separate columns, as this query is
definitely going to kill your database (there's no way to make an
index for it, the database will have to go through all rows), but you
could do it like this if you're using MySQL:

find(:all, :conditions => ["HOUR( date ) >= ? AND HOUR( date ) <= ?", 2, 4])

On Wed, Oct 8, 2008 at 10:44 PM, David <[EMAIL PROTECTED]> wrote:
>
> I am wondering if it is possible to use a find condition to find
> objects according to the hour, ignoring the date.  For example, i have
> a date field storing DateTime objects in the database and I want to
> find all objects where the hour is between the times 2:00PM and 4:00PM
> regardless of their date.  It seems that to do this, ActiveRecord
> would have to perform an operation on each DateTime to find the hour,
> such as:
>
> find(:all, :conditions => ["date.hour >= ? AND date.hour <= ?",
> 2:00PM, 4:00PM])
>
> I know this does not work, but it helps to convey my goal.  Maybe I
> have to write a raw SQL condition?  Maybe it is easier to just save
> the time values in a separate field for each object in the database in
> the firstplace?  I know saves are expensive and was trying to avoid
> them.

-- 
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)
João Pessoa, PB, +55 83 8867-7208

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



[Rails] Re: Why find_by_sql works and find(args) doesn't

2008-10-08 Thread Maurício Linhares

It's "conditions", not "condition":

Campsite.find(:all, :conditions => ['walk_id = ?',params[:walks][:id]])

On Wed, Oct 8, 2008 at 10:01 PM, Jay Pangmi
<[EMAIL PROTECTED]> wrote:
>
> I'm trying to use Campsite.find(:all, :condition => ['walk_id =
> ?',params[:walks][:id]]) but fails and instead, if I use
> Campsite.find_by_sql("select * from campsites where walk_id =
> "+params[:walks][:id]), it works fine. So, I'm wondering why..
> I've created combo box as:
> <%form_tag do%>
>  <%=select :walks, :id, @great_walks%>
> <%end%>
>
> thanks.
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>



-- 
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)
João Pessoa, PB, +55 83 8867-7208

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



[Rails] :find conditions using hour value of saved DateTime object

2008-10-08 Thread David

I am wondering if it is possible to use a find condition to find
objects according to the hour, ignoring the date.  For example, i have
a date field storing DateTime objects in the database and I want to
find all objects where the hour is between the times 2:00PM and 4:00PM
regardless of their date.  It seems that to do this, ActiveRecord
would have to perform an operation on each DateTime to find the hour,
such as:

find(:all, :conditions => ["date.hour >= ? AND date.hour <= ?",
2:00PM, 4:00PM])

I know this does not work, but it helps to convey my goal.  Maybe I
have to write a raw SQL condition?  Maybe it is easier to just save
the time values in a separate field for each object in the database in
the firstplace?  I know saves are expensive and was trying to avoid
them.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Finding out how many assets each user has

2008-10-08 Thread Craig Demyanovich
user.assets.size will do the trick. The query that's issued will look
something like

SELECT count(*) AS count_all FROM `assets` WHERE (`assets`.user_id = 7524)

Regards,
Craig

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



[Rails] passenger dedicated server

2008-10-08 Thread fRAnKEnSTEin

Hi,
I am trying to install/configure Passenger on a dedicated centos
server. I have installed passenger successfully, but i am having to
much troubles trying to configure it with my dedicated server, I have
read/saw your screencasts, documentation, buyed peepcode.com
screencasts about this issue etc, but still can not get the thing
working, hope you give me some help.
After passenger installation i pasted all the lines into my
httpd.conf
file as the installation indicates, but well i have some problems
here:
First of all, my dedicated server uses cpanel, this means that i can
not just open directly the http.donf file to make changes because
cPanel rebuilds the file on every update or account creation by
compiling from its userdata files. So any VirtualHost created will be
lost(in fcat any change that i have made will be lost). To create a
custom VirtualHost, in my case i need to create a new domain account
from my WebHostManager and then edit the cPanel files for this
account
located in /var/cpanel/userdata/username folder, not just, copy-paste
the lines that passenger installation gaves to me, at this point i
dont know how to configure this virtualhost thing? besides this,
the screencast of phusion site, tells that i have to configure de
etc/
hosts file but in my case i am not configuring a local passenger
install, so the /ect/hosts could not be configured equal as the
screencast does...or yes?
So where/how i have to paste/configure my passenger installation in
order to work with a dedicated server??? i have tryed a lot of
variations, none of them works, even i have talked with some irc, and
they told me that i have just to follow the passenger installation
instructions(it means copy-pasted the lines in http.conf) but this
this is not working, am i doing something wrong, any idea/advice?
Regards,
Shirkavand
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: gem 1.3.0, netbeans 6.1 "Missing the Rails gem"

2008-10-08 Thread Rick

Pablo,

I've noticed a similar problem with 6.5M and 6.5Beta.  My problem
turned out to be a NetBeans call to Rake that was failing.  I've filed
with Sun-NetBeansDev, issue 149201.

My problem was in NetBeans source ruby2/rake_tasks_info.rb.  On line 9
of that file is a call to "do_option" method on rake.  This method
appears to exist in rake v0.7.? but not in v0.8.? and rake v0.8.3 is
the one that's currently shipping.

I just commented out line 9 in the NB file and all (appears to) work
fine.

You might want to turn on your IDE logging and check that you're
having the same (rake failure) problem as without the log the info
reported leads you to believe you have a different (bigger) problem.

Rick

On Oct 8, 9:47 am, "Pablo Q." <[EMAIL PROTECTED]>
wrote:
> I'm on ubuntu 8.04 and I'm using  netbeans 6.1 with native ruby option.
>
> [EMAIL PROTECTED]:/home/castor# gem --version
> 1.3.0
> [EMAIL PROTECTED]:/home/castor# ruby --version
> ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]
>
> I'm able to run scripts/console from command:
>
> [EMAIL PROTECTED]:/home/castor/projects/Aflus# script/console
> Loading development environment (Rails 2.1.1)
>
>
>
> but when I try to run the same from netbeans rails console I get this:
>
> Missing the Rails  gem. Please `gem install -v= rails`, update your
> RAILS_GEM_VERSION setting in config/environment.rb for the Rails version
> you do have installed, or comment out RAILS_GEM_VERSION to use the
> latest version installed.
>
> I checked the configuration of the ruby platform and it looks fine
>
> Any idea?
>
> --
> Pablo Q.
>
> Attachments:http://www.ruby-forum.com/attachment/2789/Screenshot-Ruby_Platform_Ma...
>
> --
> 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-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: acts as ferret

2008-10-08 Thread aa aa

DavidPaquet wrote:
> Hi,
> 
> I know that it's not your question, but alot of people seem to have
> problems with Ferret in production.  Might I suggest to switch to
> Sphinx using ThinkingSphinx plugin before it's too late? :)
Bloody brilliant David!
 The ThinkingSphinx quickstart had the EXACT example i needed. After 
re-reading sphinx install instructions (forgot the --with-pgsq option), 
setup was a breeze and it works perfectly!

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

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



[Rails] Finding out how many assets each user has

2008-10-08 Thread AtsoK

I'm sure this is a dumb question, but how could I find out how many
assets (or anything that belongs to a user) each user has? I can only
think of looping through each user and adding the asset size to an
array, but when you have thousands of users, that can take a lot of
time and memory. Thanks for the help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Why find_by_sql works and find(args) doesn't

2008-10-08 Thread Jay Pangmi

I'm trying to use Campsite.find(:all, :condition => ['walk_id =
?',params[:walks][:id]]) but fails and instead, if I use
Campsite.find_by_sql("select * from campsites where walk_id =
"+params[:walks][:id]), it works fine. So, I'm wondering why..
I've created combo box as:
<%form_tag do%>
 <%=select :walks, :id, @great_walks%>
<%end%>

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



[Rails] Re: HABTM & Many through association.

2008-10-08 Thread RoR_Nb

Lovely

This might be a php solution but it works:

def tagging=(tagging)
Tag.delete_all "technology_id not in (" + tagging.to_s + ") and
blog_id = " +self.id.to_s
tagging.each do |tag|
  self.tags.create(:technology_id => tag) unless tags.any?{|t|
t.technology_id.to_i == tag.to_i}
end
  end

On Oct 7, 2:33 pm, RoR_Nb <[EMAIL PROTECTED]> wrote:
> It did remove the mysql error thanks a lot guys.
> but there's still a problem, and what happens is
> that if i have 2 tags selected and then i unchecked 1 then it deletes
> both,
> maybe it has to do with the code. but i guess it's my login what's not
> working,
> is that correct?.
>
> I'll work on that and if i find a solution i'll post it here for
> future other people to see it.
>
> On Oct 7, 3:33 am, Frederick Cheung <[EMAIL PROTECTED]>
> wrote:
>
> > On 6 Oct 2008, at 07:43, RoR_Nb wrote:
>
> > > I know i don't have an id for the join table
>
> > With has_many :through, the join table is a model in its own right and  
> > needs a promary key
>
> > Fred
>
> > > class CreateTags < ActiveRecord::Migration
> > >  def self.up
> > >    create_table :tags, :id => false do |t|
> > >      t.integer :blog_id
> > >      t.integer :technology_id
> > > ..
> > >  end
> > > end
>
> > > How can i solve this problem?
> > > thanks in advanced
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: error running "script/console --sandbox" on Edge

2008-10-08 Thread Mike Breen

looks like this just got fixed:

http://github.com/rails/rails/commit/bbb2fda11564b2d40c6c07c5a3c91cccb77fb653


On Sep 23, 2:06 pm, Mike Breen <[EMAIL PROTECTED]> wrote:
> Loading development environment in sandbox (Rails 2.2.0)
> Any modifications you make will be rolled back on exit
> /my_project/vendor/rails/activerecord/lib/active_record/base.rb:
> 1760:in `method_missing':NoMethodError: undefined method
> `increment_open_transactions' for ActiveRecord::Base:Class
>
> I don't have this problem on 2.1.1.
>
> I was just wondering if anyone else has run into this error before I
> bother with a ticket.
>
> Thanks.
> Mike
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: No such file or directory, file_column problem

2008-10-08 Thread Wu Chang

Lars-göran Andersson wrote:
> Wu Chang wrote:
>> I changed the line 210 in file_column.rb to following:
>> FileUtils.mv(local_file_path, new_local_file_path) unless 
>> new_local_file_path.upcase == local_file_path.upcase
> 
> I've tried that but no success.
> I tried to debug and found that it want to move the temporary directory 
> to a new that not exist and then it bailouts. The image column is never 
> updated so it is allways nil.
> 
> ex:
> mv app/public/object/image/tmp/unique_dir_name/ to 
> app/public/object/image/development/id/
> 
> The destination does not exist. I don't know what rails do in the 
> background but normally you can't move a dir to a dir that do not exist. 
> Maybe it tries to rename it but I'm sure there are restrictions also 
> there...?
> 
> I have worked with this for a couple of weeks now.. I never had such a 
> problem in my whole programming life (about 30 years).
> 
> I'm sure it's a bug - How can I make it work


I guess the places of bugs:

   1.the uploaded file name will be sanitized before move to 
"app/public/object/image/development/id/", so, you can print the file 
name when debuging the file_column, try to find the bugs.
   2.the destination's permission.
   3.get the latest version of file_column.


Good luck.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: display a form with selected values from URL

2008-10-08 Thread robertderosny

thanks for your help

/authors/3/books/new gives me a

Routing Error
No route matches "/authors/3/books/new" with {:method=>:get}

I guess i need to update my routes.rb for this to work ?

i've tried this :

map.resources :books, :path_prefix => "/authors/:author_id"

without success ..


if that helps : i'm using rails 2 with REST.


On 8 oct, 19:26, Freddy Andersen <[EMAIL PROTECTED]> wrote:
> Two ways the good and the bad :
>
> Good:
>
> url:
> /author/1/book/new
>
> BookController
> new
> @author = Author.find(params[:author_id])
> @book = @author.books.new
>
> or (not so good)
>
> BookController
>
> @author = Author.find(params[:author])
> @book = Book.new
> @book.author = @author
>
> Should work too...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How does one specify plugin versions under git?

2008-10-08 Thread Anthony E.

Are there any simple instructions for installing a plugin hosted on 
github?

./script/plugin install git://github.com/latimes/craken.git


This doesn't seem to work for me, as I'm using svn locally.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Managing Plugins/Gems for a specific app

2008-10-08 Thread DavidPaquet

If you are using a recent version of (Rails 2.0+ I think) you can use
the config.gem directive in environnment.rb like this :

config.gem "hpricot", :version => '0.6', :source => "http://
code.whytheluckystiff.net"

After that, you can do a rake gems:install on new installations.

On Oct 8, 1:24 pm, CPerry <[EMAIL PROTECTED]> wrote:
> I am curious to know what the best way (or most ideal way) is to
> handle keeping gems/plugins updated for a Rails app that gets updated
> quite frequently.
>
> I am currently building an app that will be using like 8 plugins,
> along with 9-10 gem packages. I would like to keep these updated as
> well as possible while making it easy on myself to do so. Also, I want
> to be sure that when deployment time comes, I make that process as
> easy as possible as well.
>
> For the plugin side of things, I have been checking out the new
> "git_plugins" plugin and it looks 
> promising.http://www.railslodge.com/plugins/1208-git-plugins
>
> For those of you using a lot of gems/plugins, how do you keep them
> maintained and up to date easily?
>
> --Cory
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: acts as ferret

2008-10-08 Thread DavidPaquet

Hi,

I know that it's not your question, but alot of people seem to have
problems with Ferret in production.  Might I suggest to switch to
Shpinx using ThinkingSphinx plugin before it's too late? :)

As for your question, I don't know enough about Ferret to help you,
I'm sorry.

On Oct 8, 8:01 pm, aa aa <[EMAIL PROTECTED]> wrote:
> So i have acts as ferret working nicely except for one problem. I can't
> for the life of me filter results on a parent model!
> For example we have a tree that goes
> Account->User->Article
>
> Article.find_by_contents("hello") works great but I try something like
> Article.find_by_contents("hello", {}, {:include=>:users,
> :conditions=>["users.account_id = ?"])
>
> gives a bunch of errors, its clearly not including the users
> --
> 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-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] ActiveRecord adding quotes where it should not using JDBC Oracle Driver

2008-10-08 Thread DavidPaquet

Hi everyone,

So here is my problem :

I'm using the Oracle JDBC Driver (with JRuby) to talk to a legacy
database.  I also use set_table_name directive since my model doesn't
have the same name as my table.

class Person < ActiveRecord::Base
set_table_name 'BOTS.USERS'


In the console, if I try Person.find(1) I get an error saying that the
table doesn't exit.  The query generated is  : SELECT * FROM
"BOTS.USERS" WHERE ("BOTS.USERS".id = 1)

The thing is that this is not valid, it should be :

SELECT * FROM BOTS.USERS WHERE (BOTS.USERS.id = 1)

How could I fix this ?



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



[Rails] acts as ferret

2008-10-08 Thread aa aa

So i have acts as ferret working nicely except for one problem. I can't
for the life of me filter results on a parent model!
For example we have a tree that goes
Account->User->Article

Article.find_by_contents("hello") works great but I try something like
Article.find_by_contents("hello", {}, {:include=>:users,
:conditions=>["users.account_id = ?"])

gives a bunch of errors, its clearly not including the users
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] IE issues (go figure)

2008-10-08 Thread Jeremy

So, I have this issue with IE.  The code below is from my view and
makes an ajax call to return a list of subcategories.  The form works
just dandy in Chrome/Safari, and Firefox, but IE the Submit button
does absolutely nothing.  Click it--nothing--no error, no nothing.

Anybody have an ideas?



# My view

New Listing

<%= error_messages_for :listing %>

<% form_for(@listing) do |f| %>

  <%= render :partial => "form", :locals => {:f => f} %>

  
<%= f.submit "Create", :disable_with => "Saving..." %>
<%= link_to 'Back', show_my_listings_url(current_user.id) %>
  
<% end %>



# Form partial

<%= f.hidden_field :user_id, :value => current_user.id %>


  Name
  <%= f.text_field :name %>




  Category:
  <% form_tag "", :id=>"categories" do %>
  <% for category in @categories %>
<% if @listing.category %>
  <% if @listing.category.parent == category %>
<%= radio_button "category", :category_id, 
category.id, :checked
=> true %> <%= category.name %>
  <% else %>
<%= radio_button "category", :category_id, 
category.id %> <%=
category.name %>
  <% end %>
<% else %>
<%= radio_button "category", :category_id, 
category.id %> <%=
category.name %>
<% end %>
  <% end %>
  <% end %>





Subcategory:

<%= render :partial => "categories/subcategories", :locals =>
{:subcategories => @subcategories} %>



<%= observe_form :categories,
 :frequency => 0.5,
 :url => { :controller => "categories", :action 
=>
"ajax_subcategories" } %>


  Gender:
  <%= f.radio_button :gender, "Male" %> Male
  <%= f.radio_button :gender, "Female" %> Female



Location:
<%= f.text_field :location, :value => current_user.location %>



  Price
  <%= f.text_field :price %>



  Description
  <%= f.text_area :description %>


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



[Rails] new controller actions and url_for

2008-10-08 Thread amrita

Hi,

I just defined a new controller action "list" for one of my
controllers, let's call it "species". To routes.rb, I added the
following entry:

map.resource :species, :member => { :list => :get }

I have a helper method in which I use url_for as follows:

url_for(:controller => 'species', :action => 'list', :params =>
params.merge({:sort => key, :page => nil}))

When I call this helper method from the view, it completely bypasses
the action in the generated URL. I get a URL as follows:

http://myserver.mydomain.org:8080/species?sort=sortparam

What I expect to get is a URL as follows:

http://myserver.mydomain.org:8080/species/list?sort=sortparam

I did a `rake routes | grep list` and I do get the following two
lines:

list_species GET/species/
list
{:controller=>"species", :action=>"list"}
formatted_list_species GET/species/
list.:format
{:controller=>"species", :action=>"list"}

Could someone please point out what needs to be corrected for url_for
to work properly? Is url_for not finding a route for
controller=species and action=list or is there some other problem?


Many thanks!
Amrita
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] rake db:migrate hanging w/ oracle

2008-10-08 Thread Frank Kim

When I run rake db:migrate w/ oracle it hangs on the db:schema:dump
part and I am not sure why.

E:\work\sandbox\codeReview>rake db:migrate --trace
(in E:/work/sandbox/codeReview)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump

I think I configured my database.yml correctly.

development:
  adapter: oracle
  host: sid
  #database: sid
  username: foo
  password: 12345
  timeout: 5000

Note that it doesn't seem to matter whether I use host or database.

Also I was able to connect directly to my Oracle DB using Ruby and the
OCI8 driver.

E:\>ruby -r oci8 -e "OCI8.new('foo','12345','sid').exec('SELECT * from
users') do |r| puts r.join(' | ') ; end"

And I did install the activerecord-oracle-adapter.

Anyone know what I'm doing wrong?

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



[Rails] Re: Prototype Based Validation with form_remote_tag

2008-10-08 Thread Tiago Motta

Paul Shannon wrote:
> Hello,
> 
> I am attempting to use validation.js from
> http://tetlaw.id.au/view/blog/really-easy-field-validation-with-prototyp
> e/ with form_remote_tag. The rails form helper binds the needed
> Ajax.Updater to the onSubmit action of the form. The validation.js also
> attempts to bind to the onSubmit of the form.
> 
> The logic that is needed is
> 
> if( valid.validate() )
> {
> ...Ajax.Updater...
> }
> 
> where valid is the validation object
> 
> How can I add this logic to the onSubmit that is added by the FormHelper
> in the rails framework?


Here is the solution:
http://programandosemcafeina.blogspot.com/2008/10/validacao-no-lado-cliente-com.html


> 
> Alternatively, is anyone else using this validation library for
> client-side validation in conjunction with rails and has a better
> method?
> 
> Cheers,
> 
> Paul Shannon
> Web Applications Developer
> 
> Codeweavers Limited
> 
> Tel: 0870 443 0888
> Fax: 0870 443 0889

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

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



[Rails] Re: How to install rubygem-cobbler

2008-10-08 Thread amrita

Try running a `gem help commands`. You will get an overview of all
things you can do with gem.

Then you can do a `gem help sources` which gives the following :-)

Usage: gem sources [options]

  Options:
-a, --add SOURCE_URI Add source
-l, --list   List sources
-r, --remove SOURCE_URI  Remove source
-c, --clear-all  Remove all sources (clear the
cache)
-u, --update Update source cache

  Common Options:
-h, --help   Get help on this command
-V, --[no-]verbose   Set the verbose level of output
-q, --quiet  Silence commands
--config-file FILE   Use this config file instead of
default
--backtrace  Show stack backtrace on errors
--debug  Turn on Ruby debugging


  Summary:
Manage the sources and cache file RubyGems uses to search for gems

  Defaults:
--list

Now you can add/remove any repositories from your gem sources.



On Oct 7, 10:40 pm, Nikki <[EMAIL PROTECTED]> wrote:
> Thank you for your feedback! :)
> I have resolved my problem.
> After installing the cobbler rpm ,run "rpm -ql rubygem-cobbler",and
> the first line gives the path of rubygem-cobbler.
> Then run "gem install cobbler path --include-denpendencies".
>
> Another question:
> Could you please give me some details about changing gem repository?
>
> Thanks,
>
> Nikki
> On Oct 8, 2:56 am,amrita<[EMAIL PROTECTED]> wrote:
>
> > You could use
>
> > gem install cobbler --source  --include-dependencies
>
> > where url points to the source of the cobbler gem. Make sure you have
> > installed gem first.
>
> > Alternately you could add the repository from where you would like gem
> > to pull out cobbler, to the gem sources. After that do a `gem env`
> > just to make sure that the repository is among the sources. After that
> > running `gem install cobbler` should work.
>
> > On Oct 6, 11:57 pm, Nikki <[EMAIL PROTECTED]> wrote:
>
> > > Hi ALL,
> > >   I am newcomer and also a freshman to Ruby.
> > >   Would anyone have the experience about installing rubygem-cobbler?
> > >   I tried to run some ruby programs.It prompts "Could not find Ruby
> > > Gem cobbler(>= 0)(Gem::LoadError)".But I had tried "yum install" and
> > > to download cobbler files.They all don't work.
> > >   Would anyone give some advice?
> > >   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-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Plugins and the test environment

2008-10-08 Thread Nick

Hi guys. I'm writing a plugin for use in the test environment.
However, when I run ``rake test'' or ``rake spec'', RAILS_ENV is set
to "development" when my plugin's init.rb is run.

How do you configure a plugin to load require a file in the test
environment?

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



[Rails] Re: URIs are transformed from view to controller

2008-10-08 Thread Hassan Schroeder

On Wed, Oct 8, 2008 at 9:46 AM, Damaris Fuentes
<[EMAIL PROTECTED]> wrote:

> I have results in a list. These results are web pages, each of them have
> some radio buttons to say if they like or not that web page. So, the
> radio buttons have to store those URLs somewhere :(

Uh, that would be the 'value' attribute. :-)

I'd suggest re-reading the relevant HTML recommendation. For one
thing,  all radio buttons of a set must share the same name.

See: 

Also, slashes aren't legal characters for an id or name:



FWIW,
-- 
Hassan Schroeder  [EMAIL PROTECTED]

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



[Rails] Re: CookieStore::CookieOverflow

2008-10-08 Thread Shandy Nantz

John Barnette wrote:
> 
> You're storing too much data. You should generally avoid storing
> 'real' objects in the session. Instead, just store the ID:
> 
>   session[:user_id] = @user.id
> 
> ...and revivify the actual user object when you need it.
> 
> 
> ~ j.

That was it. Thank you. I wasted a whole day trying to figure it out but 
at least I can now stop pulling my hair out.

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

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



[Rails] Re: Javascript help

2008-10-08 Thread Philip Hallstrom


On Oct 8, 2008, at 1:07 PM, DanC wrote:

>
> I have a blog on my site and would like readers to be able to
> recommend comments.
>
> I added an integer column to my comments table called 'agree' and have
> a link to a controller which increments the entry in that column by
> one on each click.
>
> I just use @comment.increment!("agree") and then redirect back to the
> blog.
>
> However, I am paginating the comments and if you recommend a comment
> on page 2, for example, the redirect goes back to the default page 1.
>
> Is there a way to increment the table entry using some ajax in the
> controller?
>
> I am quite unfamiliar with Ajax and haven't been able to get it to
> work.

Yes.  Look at link_to_remote.  You tell it what action to hit and can  
then tell it what div to update or some other custom "sucess" action.   
In your case, I'd replace the "i agree" link with a "thanks" text or  
something.

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



[Rails] Re: CookieStore::CookieOverflow

2008-10-08 Thread John Barnette

Hi,

On Wed, Oct 8, 2008 at 2:16 PM, Shandy Nantz
<[EMAIL PROTECTED]> wrote:
> I have recently upgraded to rails 2.1.0. and since I have, the parts of
> my app that deal with CookieStore (sessions) has failed to work any
> longer. In Crome and most other browsers my code simply fails, IE7 is a
> little more forgiving since I can get logged in and then I can only see
> certain pages. My session code is pretty simple, a session is created by
> saying:
>
> session[:user] = @user

You're storing too much data. You should generally avoid storing
'real' objects in the session. Instead, just store the ID:

  session[:user_id] = @user.id

...and revivify the actual user object when you need it.


~ j.

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



[Rails] CookieStore::CookieOverflow

2008-10-08 Thread Shandy Nantz

I have recently upgraded to rails 2.1.0. and since I have, the parts of
my app that deal with CookieStore (sessions) has failed to work any
longer. In Crome and most other browsers my code simply fails, IE7 is a
little more forgiving since I can get logged in and then I can only see
certain pages. My session code is pretty simple, a session is created by
saying:

session[:user] = @user

@user being the info collected from the users table, yada, yada, yada.
Here is the error I get when I run my app in IE7:

CGI::Session::CookieStore::CookieOverflow
(CGI::Session::CookieStore::CookieOverflow):

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session/cookie_store.rb:111:in
`close'
c:/ruby/lib/ruby/1.8/cgi/session.rb:324:in `close'

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1231:in
`close_session'

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1267:in
`process_cleanup_without_session_management_support'

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session_management.rb:140:in
`process_cleanup_without_components'

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/components.rb:162:in
`process_cleanup'

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:537:in
`process_without_filters'

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:569:in
`process_without_session_management_support'

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session_management.rb:130:in
`process'

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:389:in
`process'

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:149:in
`handle_request'

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:107:in
`dispatch'

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in
`synchronize'

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in
`dispatch'

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:120:in
`dispatch_cgi'

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:35:in
`dispatch'
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/webrick_server.rb:112:in
`handle_dispatch'
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/webrick_server.rb:78:in
`service'
c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
c:/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
c:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'
c:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
c:/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'
c:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'
c:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'
c:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'
c:/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/webrick_server.rb:62:in
`dispatch'

c:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/servers/webrick.rb:66
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'

c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in
`require'

c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in
`new_constants_in'

c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in
`require'
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:39
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
./script/server:3
-e:4:in `load'
-e:4

Rendering
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/templates/rescues/layout.erb
(internal_server_error)
/!\ FAILSAFE /!\  Wed Oct 08 15:08:52 -0600 2008
  Status: 500 Internal Server Error
  CGI::Session::CookieStore::CookieOverflow

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session/cookie_store.rb:111:in
`close'
c:/ruby/lib/ruby/1.8/cgi/session.rb:324:in `close'

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1231:in
`close_session'

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1267:in
`process_cleanup_without_session_management_support'

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session_management.rb:140:in
`process_cleanup_without_components'

c:/ruby/lib/ruby/gems/1.8/gems/actio

[Rails] Re: Weird Deprecation Warning

2008-10-08 Thread Glen

On Oct 8, 2:28 pm, Frederick Cheung <[EMAIL PROTECTED]>
wrote:
> Sent from my iPhone
>
> On 8 Oct 2008, at 21:19, Glen <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > On Oct 8, 2:08 pm, Frederick Cheung <[EMAIL PROTECTED]>
> > wrote:
> >> On Oct 8, 8:44 pm, Glen <[EMAIL PROTECTED]> wrote:
>
> >>> I am getting the following message in my development.log after
> >>> installing mongrel_service, installing the service and starting the
> >>> service.
>
> >>> DEPRECATION WARNING: config.action_view.cache_template_extensions
> >>> option has been deprecated and has no affect. Please remove it from
> >>> your config files.  Seehttp://www.rubyonrails.org/deprecationfor
> >>> details. (called from send at C:/ruby/lib/ruby/gems/1.8/gems/
> >>> rails-2.1.0/lib/initializer.rb:455)
>
> >> The bit abouthttp://www.rubyonrails.org/deprecationis a generic
> >> message and possibly not relevant. Other than that it should be  
> >> pretty
> >> clear: that setting no longer has any effect so you might as well  
> >> just
> >> remove it.
>
> >> Fred
>
> > That's all well and good but I'm not sure what is responsible.  Line
> > 455 in inilializer.rb doesn't actually call that it calls a value
> > passed to it from somewhere else.  I was kind of hoping I wouldn't
> > have to trace it by hand.
>
> Just look for cache_template_extensions in the files in config
>
> Fred
>
>
>
> >>> After checkinghttp://www.rubyonrails.org/deprecationIamstill
> >>> searching for illumination.
>
> >>> the mongrel_service gem did upgrade mongrel to 1.1.5

Thanks Fred,

I realize it was only a deprecation warning but I was hoping it was
what was causing mongrel_service to not work.  Back to the drawing
board I guess.

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



[Rails] Re: Javascript help

2008-10-08 Thread DanC

Have got a work around now using {redirect_to :back} in the controller
but would still like to hear about a javascript option if anyone has
advice.

Dan

On Oct 8, 9:07 pm, DanC <[EMAIL PROTECTED]> wrote:
> I have a blog on my site and would like readers to be able to
> recommend comments.
>
> I added an integer column to my comments table called 'agree' and have
> a link to a controller which increments the entry in that column by
> one on each click.
>
> I just use @comment.increment!("agree") and then redirect back to the
> blog.
>
> However, I am paginating the comments and if you recommend a comment
> on page 2, for example, the redirect goes back to the default page 1.
>
> Is there a way to increment the table entry using some ajax in the
> controller?
>
> I am quite unfamiliar with Ajax and haven't been able to get it to
> work.
>
> Thanks
>
> Dan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: schema.dump chokes on RAW type

2008-10-08 Thread Rob Sargent

Rob Sargent wrote:
> 
> 
> Frederick Cheung wrote:
>> On Oct 8, 8:29�pm, Rob Sargent <[EMAIL PROTECTED]>
>> wrote:
>> 
>> If you are using stuff the ruby schema dumper does not understand you
>> may just have to switch the schema dumper format to :sql (in
>> environment.rb), although this does tend to kill cross database
>> compatibility.
>> 
>> Fred
> 
> OK, I'll look into that.  Thank

Setting 'config.active_record.schema_format = :sql' in environment.rb 
appears to have turned dump off altogether.  Was that the expected 
result?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Weird Deprecation Warning

2008-10-08 Thread Frederick Cheung



Sent from my iPhone

On 8 Oct 2008, at 21:19, Glen <[EMAIL PROTECTED]> wrote:

>
> On Oct 8, 2:08 pm, Frederick Cheung <[EMAIL PROTECTED]>
> wrote:
>> On Oct 8, 8:44 pm, Glen <[EMAIL PROTECTED]> wrote:
>>
>>> I am getting the following message in my development.log after
>>> installing mongrel_service, installing the service and starting the
>>> service.
>>
>>> DEPRECATION WARNING: config.action_view.cache_template_extensions
>>> option has been deprecated and has no affect. Please remove it from
>>> your config files.  Seehttp://www.rubyonrails.org/deprecationfor
>>> details. (called from send at C:/ruby/lib/ruby/gems/1.8/gems/
>>> rails-2.1.0/lib/initializer.rb:455)
>>
>> The bit abouthttp://www.rubyonrails.org/deprecationis  a generic
>> message and possibly not relevant. Other than that it should be  
>> pretty
>> clear: that setting no longer has any effect so you might as well  
>> just
>> remove it.
>>
>> Fred
>>
>>
>
> That's all well and good but I'm not sure what is responsible.  Line
> 455 in inilializer.rb doesn't actually call that it calls a value
> passed to it from somewhere else.  I was kind of hoping I wouldn't
> have to trace it by hand.
>
Just look for cache_template_extensions in the files in config

Fred
>>
>>> After checkinghttp://www.rubyonrails.org/deprecationIam still
>>> searching for illumination.
>>
>>> the mongrel_service gem did upgrade mongrel to 1.1.5
> >

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



[Rails] Re: Weird Deprecation Warning

2008-10-08 Thread Glen

On Oct 8, 2:08 pm, Frederick Cheung <[EMAIL PROTECTED]>
wrote:
> On Oct 8, 8:44 pm, Glen <[EMAIL PROTECTED]> wrote:
>
> > I am getting the following message in my development.log after
> > installing mongrel_service, installing the service and starting the
> > service.
>
> > DEPRECATION WARNING: config.action_view.cache_template_extensions
> > option has been deprecated and has no affect. Please remove it from
> > your config files.  Seehttp://www.rubyonrails.org/deprecationfor
> > details. (called from send at C:/ruby/lib/ruby/gems/1.8/gems/
> > rails-2.1.0/lib/initializer.rb:455)
>
> The bit abouthttp://www.rubyonrails.org/deprecationis  a generic
> message and possibly not relevant. Other than that it should be pretty
> clear: that setting no longer has any effect so you might as well just
> remove it.
>
> Fred
>
>

That's all well and good but I'm not sure what is responsible.  Line
455 in inilializer.rb doesn't actually call that it calls a value
passed to it from somewhere else.  I was kind of hoping I wouldn't
have to trace it by hand.

>
> > After checkinghttp://www.rubyonrails.org/deprecationIam still
> > searching for illumination.
>
> > the mongrel_service gem did upgrade mongrel to 1.1.5
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Weird Deprecation Warning

2008-10-08 Thread Frederick Cheung



On Oct 8, 8:44 pm, Glen <[EMAIL PROTECTED]> wrote:
> I am getting the following message in my development.log after
> installing mongrel_service, installing the service and starting the
> service.
>
> DEPRECATION WARNING: config.action_view.cache_template_extensions
> option has been deprecated and has no affect. Please remove it from
> your config files.  Seehttp://www.rubyonrails.org/deprecationfor
> details. (called from send at C:/ruby/lib/ruby/gems/1.8/gems/
> rails-2.1.0/lib/initializer.rb:455)

The bit about http://www.rubyonrails.org/deprecation is  a generic
message and possibly not relevant. Other than that it should be pretty
clear: that setting no longer has any effect so you might as well just
remove it.

Fred
>
> After checkinghttp://www.rubyonrails.org/deprecationI am still
> searching for illumination.
>
> the mongrel_service gem did upgrade mongrel to 1.1.5
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Javascript help

2008-10-08 Thread DanC

I have a blog on my site and would like readers to be able to
recommend comments.

I added an integer column to my comments table called 'agree' and have
a link to a controller which increments the entry in that column by
one on each click.

I just use @comment.increment!("agree") and then redirect back to the
blog.

However, I am paginating the comments and if you recommend a comment
on page 2, for example, the redirect goes back to the default page 1.

Is there a way to increment the table entry using some ajax in the
controller?

I am quite unfamiliar with Ajax and haven't been able to get it to
work.

Thanks

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



[Rails] Re: schema.dump chokes on RAW type

2008-10-08 Thread Rob Sargent



Frederick Cheung wrote:
> On Oct 8, 8:29�pm, Rob Sargent <[EMAIL PROTECTED]>
> wrote:
> 
> If you are using stuff the ruby schema dumper does not understand you
> may just have to switch the schema dumper format to :sql (in
> environment.rb), although this does tend to kill cross database
> compatibility.
> 
> Fred

OK, I'll look into that.  Thank
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Hpricot loop question to read table row values

2008-10-08 Thread Becca Girl

Mark Thomas wrote:

> Who needs loops when you have XPath? You can grab an entire column in
> one fell swoop.
> 
>   require 'xml'
>   doc = XML::Parser.string(html).parse
>   column1 = doc.find('/table/tr[position()>1]/td[1]/text()')
>   puts column1.to_a
> 
> You'll need libxml for that (gem install libxml-ruby). Hpricot is not
> XPath compliant enough.
> 
> See my XPath article here:
> http://markthomas.org/2008/08/22/improve-your-XML-parsing-with-XPath/
> 
> -- Mark.


I looked over you XPath article.  Thanks.

But given the table structure noted above, will XPath actually work to 
take the variables that I need in each of the columns and insert those 
into database fields?  I need to locate 3 separate columns and grab each 
of those by row and insert those into a table.  So the html and the 
database table will end up looking the same.

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



[Rails] gem 1.3.0, netbeans 6.1 "Missing the Rails gem"

2008-10-08 Thread Pablo Q.

I'm on ubuntu 8.04 and I'm using  netbeans 6.1 with native ruby option.

[EMAIL PROTECTED]:/home/castor# gem --version
1.3.0
[EMAIL PROTECTED]:/home/castor# ruby --version
ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]

I'm able to run scripts/console from command:

[EMAIL PROTECTED]:/home/castor/projects/Aflus# script/console
Loading development environment (Rails 2.1.1)
>>

but when I try to run the same from netbeans rails console I get this:

Missing the Rails  gem. Please `gem install -v= rails`, update your
RAILS_GEM_VERSION setting in config/environment.rb for the Rails version
you do have installed, or comment out RAILS_GEM_VERSION to use the
latest version installed.

I checked the configuration of the ruby platform and it looks fine

Any idea?

--
Pablo Q.

Attachments:
http://www.ruby-forum.com/attachment/2789/Screenshot-Ruby_Platform_Manager.png

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

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



[Rails] Re: No such file or directory, file_column problem

2008-10-08 Thread Lars-göran Andersson

Wu Chang wrote:
> I changed the line 210 in file_column.rb to following:
> FileUtils.mv(local_file_path, new_local_file_path) unless 
> new_local_file_path.upcase == local_file_path.upcase

I've tried that but no success.
I tried to debug and found that it want to move the temporary directory 
to a new that not exist and then it bailouts. The image column is never 
updated so it is allways nil.

ex:
mv app/public/object/image/tmp/unique_dir_name/ to 
app/public/object/image/development/id/

The destination does not exist. I don't know what rails do in the 
background but normally you can't move a dir to a dir that do not exist. 
Maybe it tries to rename it but I'm sure there are restrictions also 
there...?

I have worked with this for a couple of weeks now.. I never had such a 
problem in my whole programming life (about 30 years).

I'm sure it's a bug - How can I make it work
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Weird Deprecation Warning

2008-10-08 Thread Glen

I am getting the following message in my development.log after
installing mongrel_service, installing the service and starting the
service.

DEPRECATION WARNING: config.action_view.cache_template_extensions
option has been deprecated and has no affect. Please remove it from
your config files.  See http://www.rubyonrails.org/deprecation for
details. (called from send at C:/ruby/lib/ruby/gems/1.8/gems/
rails-2.1.0/lib/initializer.rb:455)

After checking http://www.rubyonrails.org/deprecation I am still
searching for illumination.

the mongrel_service gem did upgrade mongrel to 1.1.5
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Hpricot loop question to read table row values

2008-10-08 Thread Mark Thomas



On Oct 7, 6:01 pm, Becca Girl <[EMAIL PROTECTED]>
wrote:
> Hi.
>
> I've got a file that contains a table that looks like this:
>
> 
>   column title acolumn title b
>   row 1 arow 1 b
>   row 2 arow 2 b
>   row 3 arow 3 b
>   row 4 arow 4 b
> 
>
> I need to read the rows starting with the second table row, which
> excludes the title of the column.  Then I need to read each column's
> value.
>
> How can I loop through each row to get each value that I need?

Who needs loops when you have XPath? You can grab an entire column in
one fell swoop.

  require 'xml'
  doc = XML::Parser.string(html).parse
  column1 = doc.find('/table/tr[position()>1]/td[1]/text()')
  puts column1.to_a

You'll need libxml for that (gem install libxml-ruby). Hpricot is not
XPath compliant enough.

See my XPath article here:
http://markthomas.org/2008/08/22/improve-your-XML-parsing-with-XPath/

-- Mark.

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



[Rails] Re: swfupload with active_record_store? Or any other 'mass'-uploader?

2008-10-08 Thread JWB

We applied the patch as Peter described and had good results.
Recently, the uploads started failing for a significant number of our
users - they are told to login even though they already
authenticated.  We upgraded to Rails 2.1.1, so I'm looking for a cause
there (though tests succeed).  I'm also looking for browser-specific
behavior, since some users seem to be able to upload successfully.

Please let me know if you've seen any new issues crop up with Rails
2.1.1.

On Sep 18, 12:58 am, Peter De Berdt <[EMAIL PROTECTED]> wrote:
> On 18 Sep 2008, at 00:46, Jörg Battermann wrote:
>
> > Has anyone successfully integrated swfupload into his/her rails (2.x)
[ .. snip ..]
>
> You're going to face the same problem with all of them, and to be  
> honest, SWFUpload is the only one I got to work with Rails >2 apps.
>
> If you follow my instructions as I posted them a while ago, you should  
> be able to get it to work (my solution works for sure with the  
> cookiestore, but it should work for any session 
> store):http://www.ruby-forum.com/topic/161291
>
> Best regards
>
> Peter De Berdt

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



[Rails] Re: schema.dump chokes on RAW type

2008-10-08 Thread Frederick Cheung



On Oct 8, 8:29 pm, Rob Sargent <[EMAIL PROTECTED]>
wrote:
> I haven't seen anyone mention this yet.
>
> The tail end of the migration process is a call to schema.dump.  Our
> primary keys are uuids and these choke schema.dump on both oracle and
> postgres.  The latter fails silently (skips three tables) while the
> former complains about the RAW(16) in each of the three tables.
>
> Anyone had a similar experience?

If you are using stuff the ruby schema dumper does not understand you
may just have to switch the schema dumper format to :sql (in
environment.rb), although this does tend to kill cross database
compatibility.

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



[Rails] schema.dump chokes on RAW type

2008-10-08 Thread Rob Sargent

I haven't seen anyone mention this yet.

The tail end of the migration process is a call to schema.dump.  Our
primary keys are uuids and these choke schema.dump on both oracle and
postgres.  The latter fails silently (skips three tables) while the
former complains about the RAW(16) in each of the three tables.

Anyone had a similar experience?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Hpricot loop question to read table row values

2008-10-08 Thread Becca Girl

Philip Hallstrom wrote:

> I don't know if hpricot's result set supports slice, but you could do
> something like this:
> 
> doc.search('table td').slice(1,).each do |td_ele|
>.
> end
> 


Thanks, but I've actually been able to move past the point of parsing 
out my variables.  Now I just need to figure out how to save my results.

Any thoughts on that would be very much appreciated.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Mongrel hangs with 100% CPU / EBADF (Bad file descriptor)

2008-10-08 Thread Anthony E.

Same problem here...CPU up to 99% -- app is unresponsive.

$ strace -p :

sigprocmask(SIG_BLOCK, NULL, [])= 0
sigprocmask(SIG_BLOCK, NULL, [])= 0
sigprocmask(SIG_BLOCK, NULL, [])= 0
sigprocmask(SIG_BLOCK, NULL, [])= 0
sigprocmask(SIG_BLOCK, NULL, [])= 0
sigprocmask(SIG_BLOCK, NULL, [])= 0

Over and over...

PID USER  PR  NI  VIRT  RES  SHR S %CPU %MEMTIME+   PPID COMMAND
5393 ettinger  21   0  821m 810m 2680 R 97.9 40.1   2:51.87 1 
/usr/bin/ruby1.8 /usr/bin/mongrel_rails start -C /h
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: How to let a user render a partial?

2008-10-08 Thread Frederick Cheung


On 8 Oct 2008, at 19:00, David Trasbo wrote:

>
> Frederick Cheung wrote:
>
>> I'd have a look a string scanner if I were you
>> Fred
>>
>> Sent from my iPhone
>
> That's exactly what I've been thinking of, but the real challenge is  
> to
> get the regular expression right. It needs to respect multiple
> arguments. Any suggestions?

that's the point - with stringscanner you don't need to come up with  
one giant regular expression that gets everything right

as a quick example, this

require 'strscan'
s = StringScanner.new('blah {some_partial arg1:foo arg2:bar} other  
stuff here {otherpartial arg1:baz}')

while s.scan_until /\{/
   puts "start of call"
   puts s.scan /\w+/
   s.skip /\s+/
   while  output=s.scan( /\w+:\w+/)
 puts output
 s.skip /\s+/
   end
   s.skip_until /\}/
   puts "end of call"
end

outputs

start of call
some_partial
arg1:foo
arg2:bar
end of call
start of call
otherpartial
arg1:baz
end of call


Fred

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


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



[Rails] Re: ActiveRecord filesystem based backend

2008-10-08 Thread Eric Schulte

Frederick Cheung <[EMAIL PROTECTED]> writes:

> There are a number of ActiveModel (which would abstract out some of  
> the relevant bits) efforts going on that may be of interest.
>

That's good to know, do you know any names/links/pointers for these
efforts?

Thanks -- Eric

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



[Rails] Re: ActiveRecord filesystem based backend

2008-10-08 Thread Frederick Cheung


On 8 Oct 2008, at 19:31, Maurício Linhares wrote:

>
> If you write something that "looks like" active record, the view/form
> methods woudn't change, but the association methods (has_one, has_many
> and belongs_to) are something deeply rooted into active record and
> SQL, they can't be reused in another context.
>
> And, unfortunately (or maybe fortunately), ActiveRecord was built with
> the expectation that there is a relational database that understands
> SQL at the other side, so it isn't really a "possibility" to do what
> you're looking for unless you start to build your own relational
> database. Also, Merb is just a web framework, it doesn't have anything
> like that.
>
A lot of activerecord generates sql fragments - it would be non  
trivial to get around that.
There are a number of ActiveModel (which would abstract out some of  
the relevant bits) efforts going on that may be of interest.

Fred

> On Wed, Oct 8, 2008 at 3:21 PM, Eric Schulte  
> <[EMAIL PROTECTED]> wrote:
>>
>> Thanks for the suggestion.  The problem with using something aside  
>> from
>> ActiveRecord is that you lose all of the view/form helpers, and (i
>> think) you also lose the has_many helper methods as well, so you'd
>> ultimately lose a large portion of the utility of the Rails  
>> framework.
>> It seems that IMO all of these helpers should be tied to a Module say
>> RailsModel or something which ActiveRecord, ActiveResource, etc...  
>> would
>> include.  I don't know how if this would introduce too much  
>> indirection
>> into the Rails framework, but it would make it much easier to  
>> introduce
>> alternative storage mechanisms.  I don't know much about Merb, but  
>> maybe
>> it already contains something similar?
>>
>> Thanks -- Eric
>>
>
> -- 
> Maurício Linhares
> http://alinhavado.wordpress.com/ (pt-br) | http:// 
> blog.codevader.com/ (en)
> João Pessoa, PB, +55 83 8867-7208
>
> >


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



[Rails] Re: a small doublt

2008-10-08 Thread Frederick Cheung


On 8 Oct 2008, at 19:52, Robert Walker wrote:

>
>> Of course to see the most benefit you'll need a ruby implementation
>> with native threads, like jruby.
> Or Ruby 1.9 YARV if I'm not mistaken?
>
IIRC ruby 1.9 is a bit special - threads are mapped to native threads,  
but there's some giant mutex (IIRC to help compatibility with C- 
extensions that could previously assume that everything was single  
threaded from a native thread point of view) that limits the  
effectiveness of this.

Fred
> Frederick Cheung wrote:
>> On 8 Oct 2008, at 18:22, Michael Sofaer <[EMAIL PROTECTED]> wrote:
>>
>>>
> ...snip...
>>
>> Fred
>
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >


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



[Rails] Re: a small doublt

2008-10-08 Thread Robert Walker

> Of course to see the most benefit you'll need a ruby implementation
> with native threads, like jruby.
Or Ruby 1.9 YARV if I'm not mistaken?

Frederick Cheung wrote:
> On 8 Oct 2008, at 18:22, Michael Sofaer <[EMAIL PROTECTED]> wrote:
> 
>>
...snip...
> 
> Fred

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

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



[Rails] Re: ActiveRecord filesystem based backend

2008-10-08 Thread Maurício Linhares

If you write something that "looks like" active record, the view/form
methods woudn't change, but the association methods (has_one, has_many
and belongs_to) are something deeply rooted into active record and
SQL, they can't be reused in another context.

And, unfortunately (or maybe fortunately), ActiveRecord was built with
the expectation that there is a relational database that understands
SQL at the other side, so it isn't really a "possibility" to do what
you're looking for unless you start to build your own relational
database. Also, Merb is just a web framework, it doesn't have anything
like that.

On Wed, Oct 8, 2008 at 3:21 PM, Eric Schulte <[EMAIL PROTECTED]> wrote:
>
> Thanks for the suggestion.  The problem with using something aside from
> ActiveRecord is that you lose all of the view/form helpers, and (i
> think) you also lose the has_many helper methods as well, so you'd
> ultimately lose a large portion of the utility of the Rails framework.
> It seems that IMO all of these helpers should be tied to a Module say
> RailsModel or something which ActiveRecord, ActiveResource, etc... would
> include.  I don't know how if this would introduce too much indirection
> into the Rails framework, but it would make it much easier to introduce
> alternative storage mechanisms.  I don't know much about Merb, but maybe
> it already contains something similar?
>
> Thanks -- Eric
>

-- 
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)
João Pessoa, PB, +55 83 8867-7208

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



[Rails] Re: ActiveRecord filesystem based backend

2008-10-08 Thread Eric Schulte

"Maurício Linhares" <[EMAIL PROTECTED]> writes:

> What you could do is write a simple persistence solution that "looks like"
> active record but using a simpler model (based on your ideas), removing all 
> the
> SQL and things that resemble a relational database. You could take a look at
> ActiveResource and the way it behaves to get an idea about how you could build
> your API.
>

Hi Maurício,

Thanks for the suggestion.  The problem with using something aside from
ActiveRecord is that you lose all of the view/form helpers, and (i
think) you also lose the has_many helper methods as well, so you'd
ultimately lose a large portion of the utility of the Rails framework.
It seems that IMO all of these helpers should be tied to a Module say
RailsModel or something which ActiveRecord, ActiveResource, etc... would
include.  I don't know how if this would introduce too much indirection
into the Rails framework, but it would make it much easier to introduce
alternative storage mechanisms.  I don't know much about Merb, but maybe
it already contains something similar?

Thanks -- Eric

>
> On Tue, Oct 7, 2008 at 9:24 PM, Eric Schulte <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
> I hoping to find/write an ActiveRecord backend which stores each record
> as a file in a directory, rather than as a row in a table in a database.
> I'm not concerned about scaling or concurrency issues.  My questions
> are...
>
> 1) Does such a backend exist?
> 2) Is there some logical inconsistency between the behavior of
>   ActiveRecord and the limits of a filesystem?
> 3) Where should implementation of such a backend begin? should I define
>   an AbstractAdapter? or should I scrap ActiveRecord all together, and
>   try to use another class as the base of my models?
>
> In terms of what this would look like, I'm thinking that each record
> would have a string id, which would serve as the file name, either a
> single text field aside from the ID and would be equal to the entire
> file contents, or allow for multiple attributes, and save them into the
> file in the form of a YAML hash.
>
> The use case which got me thinking of this was the desire to have an
> rails application which users would often run locally on their own
> machine, but with which they could share (active)records with other
> users running other copies of the application on their machines.  If the
> records were saved as files, then
>
> 1) it would be easy for users to browse/inspect the records outside of
>   the application
> 2) the sharing and merging of the records across instances could use
>   some existing distributed VC system like GIT
>
> the actual application could fairly easily wrap some simplifying UI
> elements around something like git which could handle the pushing
> pulling and merging of actual records between instances all the while
> tracking who made what changes when.
>
> Please don't hesitate to tell me if you think there are reasons why this
> wouldn't/shouldn't work. Thanks -- Eric
>
>
>
>
>
>
> --
> Maurício Linhares
> http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)
> João Pessoa, PB, +55 83 8867-7208
>
> 

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



[Rails] Re: a small doublt

2008-10-08 Thread Frederick Cheung



On 8 Oct 2008, at 17:32, Robert Walker <[EMAIL PROTECTED] 
s.net> wrote:

>
>> is a single thread(ruby green thread) created for everyone request?
> I'm going to go out on a limb here since no others have responded, but
> my understanding (at least in the current version of Rails) is no. I
> don't believe than a thread is created at all. It is my understanding
> that the Rails application instance is a single processes thread that

It probably depends on what hosts rails. For example mongrel is most  
definitely multithreaded and can handle multiple concurrent requests,  
just not concurrent requests handled by rails.

Fred
>
> handles the request all the way through to the response. The Rails
> application instance will block from the time it receives a request to
> the time it completes the response.
>
> To handle requests concurrently you need to have multiple Rails
> processes running. Typically you would use a Mongrel cluster for this.
> For best performance you also need a load balancer that is smart  
> enough
> to know not to send a request to a busy Rails instance, otherwise,  
> that
> request will be blocked until the Rails process completes it's current
> request.
>
> However, my understanding is the Mongrel, or Thin or whatever is
> concurrent and will queue up the request that it sends to the Rails
> instance for processing.
>
> That being said this is not that unusual. I believe that PHP
> applications would work in a similar way. They would spin up a process
> to handles each request. One process handling one request.
>
> This is actually a safe and scalable solution. Threading is HARD! And,
> it's dangerous if not done correctly. And in the end it doesn't really
> help you scale as much as you might expect.
>
> I'll reiterate that this is my own understanding of this, and I  
> could be
> completely off-base.
>
> Pokkai Dokkai wrote:
>> i don't understand that request ... response process in rails  
>> framework
>> .
>>
>> is a single thread(ruby green thread) created for everyone request?
>> then that single thread will be living upto the response send.
>> am i correct ?
>
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >

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



[Rails] Re: Recent Upgrade to 2.1.0 not working IE7

2008-10-08 Thread Shandy Nantz

Nevermind, I don't think it's still saving any sessions. If I changed 
the session name to session[:dude] I got the same ol' nil refernce which 
says to me that it wasn't saved, although it does seem to recgonize 
session[:user] which is a little strange. . .
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: a small doublt

2008-10-08 Thread Frederick Cheung



On 8 Oct 2008, at 18:22, Michael Sofaer <[EMAIL PROTECTED]> wrote:

>
> Yes, mongrel_cluster is the way to go if you want to handle multiple
> concurrent requests.  I recommend nginx over Apache for load balancing
> them, if you have the choice.
>
> Threading is indeed hard, but it helps immensely with scaling
> problems.   That being said, Ruby threading is not very good at all
> and ActiveRecord is not threadsafe, so Rails won't be threaded any
> time soon.
Actually rails 2.2 will be threaded (rc out real soon now).  
Activerecord itself can be used in a threadsafe way (but not in a  
rails app; i've got a few multithreaded daemons using active record).  
Of course to see the most benefit you'll need a ruby implementation  
with native threads, like jruby.

Fred
>
>
> Check out Joe Domato's blog for an example of how poorly implemented
> and debugged Ruby threading is:  
> http://timetobleed.com/ruby-threading-bugfix-small-fix-goes-a-long-way/
>
> Robert is right about how Rails handles concurrent requests (many
> instances of application) and correct that Mongrel doesn't spawn Ruby
> green threads (a good thing if you looked at the blog post above).
> However, most other web frameworks I know of don't do it that way.
> PHP and J2EE will have a master process that spawns child threads to
> handle requests, as does nginx.  This lets the OS handle load
> balancing, and switch out threads that are blocked (usually waiting
> for DB calls to return).
>
> It would be better if Rails could do that but it can't.  It's not a
> huge deal, unless you are running a very high-traffic site; just put
> up a Mongrel cluster and you will be fine.
>
> On Oct 8, 9:32 am, Robert Walker <[EMAIL PROTECTED]>
> wrote:
>>> is a single thread(ruby green thread) created for everyone request?
>>
>> I'm going to go out on a limb here since no others have responded,  
>> but
>> my understanding (at least in the current version of Rails) is no. I
>> don't believe than a thread is created at all. It is my understanding
>> that the Rails application instance is a single processes thread that
>> handles the request all the way through to the response. The Rails
>> application instance will block from the time it receives a request  
>> to
>> the time it completes the response.
>>
>> To handle requests concurrently you need to have multiple Rails
>> processes running. Typically you would use a Mongrel cluster for  
>> this.
>> For best performance you also need a load balancer that is smart  
>> enough
>> to know not to send a request to a busy Rails instance, otherwise,  
>> that
>> request will be blocked until the Rails process completes it's  
>> current
>> request.
>>
>> However, my understanding is the Mongrel, or Thin or whatever is
>> concurrent and will queue up the request that it sends to the Rails
>> instance for processing.
>>
>> That being said this is not that unusual. I believe that PHP
>> applications would work in a similar way. They would spin up a  
>> process
>> to handles each request. One process handling one request.
>>
>> This is actually a safe and scalable solution. Threading is HARD!  
>> And,
>> it's dangerous if not done correctly. And in the end it doesn't  
>> really
>> help you scale as much as you might expect.
>>
>> I'll reiterate that this is my own understanding of this, and I  
>> could be
>> completely off-base.
>>
>> Pokkai Dokkai wrote:
>>> i don't understand that request ... response process in rails  
>>> framework
>>> .
>>
>>> is a single thread(ruby green thread) created for everyone request?
>>> then that single thread will be living upto the response send.
>>> am i correct ?
>>
>> --
>> 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-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Hpricot loop question to read table row values

2008-10-08 Thread Philip Hallstrom

> I've got a file that contains a table that looks like this:
>
> 
>  column title acolumn title b
>  row 1 arow 1 b
>  row 2 arow 2 b
>  row 3 arow 3 b
>  row 4 arow 4 b
> 
>
> I need to read the rows starting with the second table row, which
> excludes the title of the column.  Then I need to read each column's
> value.
>
> How can I loop through each row to get each value that I need?
>
> To read a row of values I used
> (doc/"/html/body/table/tbody/tr[2]/td[1]").inner_html >> row 1 a
> (doc/"/html/body/table/tbody/tr[2]/td[2]").inner_html >> row 1 b
>
>
> I tried variations of each loops that would increment the table row,  
> but
> I don't have the syntax correct for it to work.

I don't know if hpricot's result set supports slice, but you could do  
something like this:

doc.search('table td').slice(1,).each do |td_ele|
   .
end

I'm cheating by picking 99 but it's easier than figuring out how  
many results there are.  I'm sure there's a method to simply remove  
that first element in a chain, but I can't think of it.

And you'd want to change that 'search' to match your table specifically.

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



[Rails] Re: How to let a user render a partial?

2008-10-08 Thread David Trasbo

Frederick Cheung wrote:

> I'd have a look a string scanner if I were you
> Fred
> 
> Sent from my iPhone

That's exactly what I've been thinking of, but the real challenge is to 
get the regular expression right. It needs to respect multiple 
arguments. Any suggestions?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Using image_tag and send_data

2008-10-08 Thread Lastps

Yep -- guess I'll step through and research the various ways to check
the size of the data at each place.  Thanks for your help!

On Oct 8, 10:20 am, Frederick Cheung <[EMAIL PROTECTED]>
wrote:
> On 8 Oct 2008, at 16:15, Lastps wrote:
>
>
>
> > Yes -- seems like attachment_fu or mysql (?) might be truncating.
> > Weird though as the file size is not very large -- just 10kb.  In my
> > experience, truncation occurs because you are handling large files...
>
> I suppose you need to pinpoint where it happens: before the image hit  
> your app, before attachment fu tried to save it, when mysql was given  
> the image, after retrieval from the database etc...
>
> Fred
>
>
>
>
>
> > On Oct 8, 10:08 am, Frederick Cheung <[EMAIL PROTECTED]>
> > wrote:
> >> On 8 Oct 2008, at 16:00, Lastps wrote:
>
> >>> Just tried something else --
> >>> Changed disposition to "attachment" and used Firefox to successfully
> >>> download the file.  When I tried to open the file (in GIMP) I  
> >>> received
> >>> these error messages:
> >>> -- Premature end of JPEG file
> >>> -- Invalid JPEG file structure: missing SOS marker
> >>> So, I guess attachment_fu is not saving the files properly to my
> >>> db_file table...
>
> >> that sounds like its getting truncated.
>
> >> Fred
>
> >>> On Oct 8, 9:54 am, Lastps <[EMAIL PROTECTED]> wrote:
>  i guess that's the point in that the browser is not displaying the
>  image -- it is just displaying the error gif, ie, a box with a  
>  red x
>  in it indicating that i can't load the image.
>
>  Fred, i really appreciate the time you're dedicating here...
>
>  On Oct 8, 9:51 am, Frederick Cheung <[EMAIL PROTECTED]>
>  wrote:
>
> > On 8 Oct 2008, at 15:47, Lastps wrote:
>
> >> logs say that all is ok:
> >> Sending data my_image.jpg
> >> Completed in 0.09400 (10 reqs/sec) | Rendering: 0.0 (0%) |  
> >> DB:
> >> 0.08000 (85%) | 200 OK [http://localhost/photo/get_image/5]
>
> >> Interesting question you ask about how do the bytes differ.  I
> >> guess I
> >> first need to find a "tool of my choice" other than my two  
> >> browsers
> >> (IE and Firefox) -- any suggestions?
>
> > using the browser to save the image to disk would be one way.
>
> > Fred
>
> >> On Oct 8, 9:18 am, Frederick Cheung <[EMAIL PROTECTED]>
> >> wrote:
> >>> On 8 Oct 2008, at 15:05, Lastps wrote:
>
>  Thanks for the suggestion --
>  I get the same red box with the x.
>
> >>> Do the logs indicate that an error occured ? If not and if you  
> >>> use
> >>> the
> >>> tool of your choice to download the image, how do the bytes  
> >>> differ
> >>> from the bytes you would expect.
>
> >>> Fred
>
>  On Oct 8, 8:47 am, Frederick Cheung  
>  <[EMAIL PROTECTED]>
>  wrote:
> > On Oct 8, 2:32 pm, Lastps <[EMAIL PROTECTED]> wrote:
>
> >> I am using image_tag to load an image that I've saved to the
> >> database
> >> (using attachment_fu if you're curious but that's probably  
> >> not
> >> relevant here):
>
> > I'd copy and paste that image link into the browser (ie
> > yourserver,com/
> > photo/get_image/5) and see what the browser pulls out.
>
> > Fred
>
> >> VIEW
> >> <%= image_tag '/photo/get_image/5' %>
>
> >> CONTROLLER
> >> def get_image
> >>   @photo=Photo.find(params[:id])
> >>   send_data(DbFile.find(@photo.db_file_id).data,
> >>                             :type => @photo.content_type,
> >>                             :file_name =>
> >> @photo.filename,
> >>                             :disposition => 'inline')
> >> end
>
> >> The images I'm saving are less than 100kb and easily handled
> >> by my
> >> mysql column of db_file.data which is declared MEDIUMBLOB.
>
> >> My problem is that the view works perfectly in production but
> >> not at
> >> all in development -- in development I just get a broken  
> >> image
> >> graphic
> >> with a box and a red x.
>
> >> Any ideas on how to troubleshoot this?  Since it doesn't seem
> >> to
> >> be my
> >> code (it works fine in production) I'm at a loss on how to
> >> figure
> >> this
> >> out.- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> >>> - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
>  - Show quoted text -- Hide quoted text -
>
> >> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from thi

[Rails] Re: Recent Upgrade to 2.1.0 not working IE7

2008-10-08 Thread Shandy Nantz

Craig Demyanovich wrote:
> 
> 
> I don't know if the session_key needs to match your app name. You could
> change it to match and see what happens.
> 
> Craig

I did change it and it seems to get me a little further. It now 
recongizes that there is a session variable. The issue is that when I 
set the session[:user] = @user, I print out the value when the session 
gets set and it print ths correct value for an id, but when I try and 
reprint it in a before_filter that I have it prints a completely 
different value - not the same id. So I am not sure what is going on 
now? I think the session issue has been taken care off, but something 
else is definetly going on. Thanks again,

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

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



[Rails] Re: How to let a user render a partial?

2008-10-08 Thread Frederick Cheung

I'd have a look a string scanner if I were you
Fred

Sent from my iPhone

On 8 Oct 2008, at 18:12, David Trasbo <[EMAIL PROTECTED] 
s.net> wrote:

>
> Hi all,
>
> I'm currently doing a little CMS system in Rails and I would like the
> user/administrator of a site to be able to render partials on pages. I
> have a Page model with a content attribute. Inside that attribute I
> would like the admin to be able to put something like this:
>
> {contact_form submit:"Submit now!" reset:"Reset form"}
>
> This is just an example, but this should then render a partial like
> this:
>
> render :partial => "widgets/contact_form", :locals => {:submit =>
> "Submit now!", :reset => "Reset form"}
>
> I have been trying to make up a regular expression to approach this,  
> but
> I'm not very good at it. It looks like this:
>
> /\{(\w+) (\w+):(.+)*\}/
>
> But it is hard to make it respect multiple arguments, if you know  
> what I
> mean. Now, if any of you have an idea of how to finish this regular
> expression, or maybe know a different solution of how to let the admin
> render partials "dynamically", I would appreciate if you'd let me  
> know.
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >

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



[Rails] Re: the performance debate

2008-10-08 Thread Michael Sofaer

Ruby in general is one of the easiest languages to code in that I've
ever seen.  It also makes it easy to use lambdas in a much more
natural fashion than I've seen before.

Rails is the simplest and easiest framework I've seen for building web
applications.

No one chooses Ruby (or Rails) because it's fast (that would be silly,
since it's not), we choose it because it helps us be more productive,
and spending more on server power to run slow code is cheaper than
spending more on developer time.  If you can find, hire and retain a
group of coders who can work efficiently and elegantly writing website
in C++, that would be a pretty fast website.  I wouldn't try it,
though.

> Crappy developers write crappy code, no matter what tool they use.
> I've seen some Ruby code that scared me to death, but the language
> isn't to blame, the blame lies on the people that use it.
>
> --
> Maurício Linhareshttp://alinhavado.wordpress.com/(pt-br) 
> |http://blog.codevader.com/(en)
> João Pessoa, PB, +55 83 8867-7208
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: display a form with selected values from URL

2008-10-08 Thread Freddy Andersen

Two ways the good and the bad :

Good:

url:
/author/1/book/new

BookController
new
@author = Author.find(params[:author_id])
@book = @author.books.new


or (not so good)

BookController

@author = Author.find(params[:author])
@book = Book.new
@book.author = @author


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



[Rails] Managing Plugins/Gems for a specific app

2008-10-08 Thread CPerry

I am curious to know what the best way (or most ideal way) is to
handle keeping gems/plugins updated for a Rails app that gets updated
quite frequently.

I am currently building an app that will be using like 8 plugins,
along with 9-10 gem packages. I would like to keep these updated as
well as possible while making it easy on myself to do so. Also, I want
to be sure that when deployment time comes, I make that process as
easy as possible as well.

For the plugin side of things, I have been checking out the new
"git_plugins" plugin and it looks promising.
http://www.railslodge.com/plugins/1208-git-plugins

For those of you using a lot of gems/plugins, how do you keep them
maintained and up to date easily?

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



[Rails] Re: a small doublt

2008-10-08 Thread Michael Sofaer

Yes, mongrel_cluster is the way to go if you want to handle multiple
concurrent requests.  I recommend nginx over Apache for load balancing
them, if you have the choice.

Threading is indeed hard, but it helps immensely with scaling
problems.   That being said, Ruby threading is not very good at all
and ActiveRecord is not threadsafe, so Rails won't be threaded any
time soon.

Check out Joe Domato's blog for an example of how poorly implemented
and debugged Ruby threading is:  
http://timetobleed.com/ruby-threading-bugfix-small-fix-goes-a-long-way/

Robert is right about how Rails handles concurrent requests (many
instances of application) and correct that Mongrel doesn't spawn Ruby
green threads (a good thing if you looked at the blog post above).
However, most other web frameworks I know of don't do it that way.
PHP and J2EE will have a master process that spawns child threads to
handle requests, as does nginx.  This lets the OS handle load
balancing, and switch out threads that are blocked (usually waiting
for DB calls to return).

It would be better if Rails could do that but it can't.  It's not a
huge deal, unless you are running a very high-traffic site; just put
up a Mongrel cluster and you will be fine.

On Oct 8, 9:32 am, Robert Walker <[EMAIL PROTECTED]>
wrote:
> > is a single thread(ruby green thread) created for everyone request?
>
> I'm going to go out on a limb here since no others have responded, but
> my understanding (at least in the current version of Rails) is no. I
> don't believe than a thread is created at all. It is my understanding
> that the Rails application instance is a single processes thread that
> handles the request all the way through to the response. The Rails
> application instance will block from the time it receives a request to
> the time it completes the response.
>
> To handle requests concurrently you need to have multiple Rails
> processes running. Typically you would use a Mongrel cluster for this.
> For best performance you also need a load balancer that is smart enough
> to know not to send a request to a busy Rails instance, otherwise, that
> request will be blocked until the Rails process completes it's current
> request.
>
> However, my understanding is the Mongrel, or Thin or whatever is
> concurrent and will queue up the request that it sends to the Rails
> instance for processing.
>
> That being said this is not that unusual. I believe that PHP
> applications would work in a similar way. They would spin up a process
> to handles each request. One process handling one request.
>
> This is actually a safe and scalable solution. Threading is HARD! And,
> it's dangerous if not done correctly. And in the end it doesn't really
> help you scale as much as you might expect.
>
> I'll reiterate that this is my own understanding of this, and I could be
> completely off-base.
>
> Pokkai Dokkai wrote:
> > i don't understand that request ... response process in rails framework
> > .
>
> > is a single thread(ruby green thread) created for everyone request?
> > then that single thread will be living upto the response send.
> > am i correct ?
>
> --
> 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-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Recent Upgrade to 2.1.0 not working IE7

2008-10-08 Thread Craig Demyanovich
On Wed, Oct 8, 2008 at 10:58 AM, Shandy Nantz <
[EMAIL PROTECTED]> wrote:

>
> I do have that in my envirnments.rn, however, my session_key says:
>
> =>_newen_session
>
> and that isn't the name of my app. My app name is new_trunk[trunk],
> should it be named something else?


I don't know if the session_key needs to match your app name. You could
change it to match and see what happens.

Craig

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



[Rails] How to let a user render a partial?

2008-10-08 Thread David Trasbo

Hi all,

I'm currently doing a little CMS system in Rails and I would like the
user/administrator of a site to be able to render partials on pages. I
have a Page model with a content attribute. Inside that attribute I
would like the admin to be able to put something like this:

{contact_form submit:"Submit now!" reset:"Reset form"}

This is just an example, but this should then render a partial like
this:

render :partial => "widgets/contact_form", :locals => {:submit =>
"Submit now!", :reset => "Reset form"}

I have been trying to make up a regular expression to approach this, but
I'm not very good at it. It looks like this:

/\{(\w+) (\w+):(.+)*\}/

But it is hard to make it respect multiple arguments, if you know what I
mean. Now, if any of you have an idea of how to finish this regular
expression, or maybe know a different solution of how to let the admin
render partials "dynamically", I would appreciate if you'd let me know.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Memory leak problem

2008-10-08 Thread Michael Sofaer

Probably not related, but should business.save at the end there be
@business.save?

On Oct 8, 9:39 am, elioncho <[EMAIL PROTECTED]> wrote:
> I have a txt file with some data that i need to import to de database.
> I'm using ruby to import those data but i have a major problem, when i
> 've
> a large amount of data i run out of memory.
>
>   File.open("#{RAILS_ROOT}/public/files/Neighborsville.TXT").each() do
> |line|
>       @stringArray = line.split("|")
>       @i += 1
>       puts @i
>       @pid = @stringArray[0]
>       @chain_id = @stringArray[1]
>       @business = Business.find_by_pid_and_chain_id(@pid,@chain_id);
>       #Check PID + CHAIN_ID
>       @business.pid = @stringArray[0]
>       @business.chain_id = @stringArray[1]
>       @business.cityname = @stringArray[17]
>       @business.state = @stringArray[18]
>       @business.business =
> Business.find_by_pid_and_chain_id(@pid,@chain_id);
>       @business.city = City.new
>       @business.business_category = get_category_id(@stringArray[40])
>       @business.address = @stringArray[8] +" "+   @stringArray[9] +"
> "+ @stringArray[10]+" "+ @stringArray[11] +" "[EMAIL PROTECTED]"
> "[EMAIL PROTECTED]" "[EMAIL PROTECTED]
>       if @chain_id == nil
>         @chain_id = ""
>       end
>       business.save
>       end
>     end
>
> I belive that ruby use in every cycle of the do new blocks of memories
> por my instances
> of Business. Can someone help me please?
>
> Thanks,
>
> Elioncho
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: the performance debate

2008-10-08 Thread CPerry

Yeah, this whole debate is getting pretty pointless now. Just use
whatever you want to use and move on, cause at the end of the day,
this is a Ruby on Rails group. You can hype PHP all you want Mauricio,
but I will take Ruby over PHP any day. You may feel differently.

--Cory

On Oct 8, 8:24 am, "Maurício Linhares" <[EMAIL PROTECTED]>
wrote:
> On Wed, Oct 8, 2008 at 9:14 AM, glennswest <[EMAIL PROTECTED]> wrote:
>
> > Well the had excellent references.
> > And I've look at it. But by software engineering standands
> > php is spagetting code.
>
> By what software engineering standards? Yours?
>
> > Ruby is modular, and for once the object oriented nature works quite well.
>
> Oh, so PHP isn't modular? Do you know that PHP has classes and
> interfaces? And that they do behave almost like Ruby classes and
> Modules?
>
> > ActiveRecord works well as well.
> > Show me php applications that can handle 400 different tables, that can be 
> > developed by one guy in two weeks?
>
> What would keep a PHP application from handling 400 or 400.000 tables?
>
> I've never seen a PHP database driver saying that it had a maximum of
> tables they could handle, maybe you can point me out to this.
>
> And about being developed by one guy, i can't see the problem also. A
> good developer is good in any language he masters.
>
> > I've seen a few php developers that were ok, but its not something I'd
> > recommend a fortune 500 use to do a proper application.
>
> Maybe you should know that Yahoo runs in PHP, Wikipedia runs in PHP,
> many of the biggest websites around use PHP.
>
> Crappy developers write crappy code, no matter what tool they use.
> I've seen some Ruby code that scared me to death, but the language
> isn't to blame, the blame lies on the people that use it.
>
> --
> Maurício Linhareshttp://alinhavado.wordpress.com/(pt-br) 
> |http://blog.codevader.com/(en)
> João Pessoa, PB, +55 83 8867-7208
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Problem with DateTime in query

2008-10-08 Thread Bosco So

Ryan Bates' screencast on this topic - http://railscasts.com/episodes/108
- has more details about delaying evaluation of the condition with a
lambda (including optional argument).

How weird, I literally just watched his screencast before reading this
question.


On Oct 8, 8:54 am, Frederick Cheung <[EMAIL PROTECTED]>
wrote:
> On 8 Oct 2008, at 16:36, cjharrelson wrote:
>
>
>
> > Here is a strange one for you:
>
> > I am using rails 2.1.0.  I am also using the Time zones feature.
>
> > I have a User model that has many enrollments.  The Enrollments model
> > has several named scopes, one of which is today:
>
> > # This named scope is adjusted to UTC
> > named_scope :today, :conditions => ["updated_at >= ? AND updated_at
> > <= ?",
> >    Time.zone.now.beginning_of_day.utc, Time.zone.now.end_of_day.utc]
>
> The Time.zone.now is evaluated precisely once: when the model is  
> loaded. Use a lambda (see the section on procedural scopes in the api  
> docs) to do something like
>
> named_scope :today, lambda { :conditions => stuff here is evaluated  
> each time the scope is accessed }
>
> 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-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Update only selected columns

2008-10-08 Thread Robert Walker

> Either provide a change password page, or a separate for used 
Sorry I meant to say a separate form on the same page.

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

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



[Rails] Re: Update only selected columns

2008-10-08 Thread Robert Walker

This is a common issue, and not with just Rails applications. You best 
bet is to design your user profile update page to not send the password. 
Either provide a change password page, or a separate for used 
specifically to change the password.

Others may have other ideas on how to deal with that. I suggest looking 
around at other profile update pages and see how they handle it.

Ian wrote:
> I'm working on an "update your profile" page.  One of the fields is
> the user's password.  I have a couple of validation rules set up in
> the user model regarding the password's minimum and maximum length and
> it not being blank, etc.  They work great.  However, is there a way to
> turn them off and not update that column if the user does not enter
> anything in that field?

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

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



  1   2   >