[Rails] Updating a RoR Project to the Higher Version

2009-06-11 Thread Soutom

I have a RoR project on rails version 1.1.6
But at present in my PC i had installed Rail of version 2.x

How can i Upgrade my project to the updated version to run
perfectly ?

Thanking You

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



[Rails] How can I identify a memory leak? using memorylogic..

2009-06-11 Thread Ram

Hi all,

I have an ROR application thats been running on the production server
for almost a couple of months now. Everything seemed fine but the past
few days have caused worry. The whole server slows down drastically
and comes to a halt suddenly and it requires a reboot for the apps i
have on the server to start being responsive again.

Memory leak?

I installed binarylogic's memory logic 
http://github.com/binarylogic/memorylogic/tree/master
which shows me memory usage on every line of my log along with the
PID. I can see that the memory usage keeps going higher with every
request on my local dev machine.
Does that mean ive got a memory leak? How do i diagnose this? I have
no experience with this and im not even sure what a bad number is when
i see one in terms of memory usage.

For information's sake, when i start the app up locally, mem starts at
around 46700 and keeps going up by about 400 with every request on
average. How can i interpret this data? Anyone used memory logic
before?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Simple text parser for wikitext

2009-06-11 Thread manohar amrutkar

Hey ,

Does anyone knows about parsing wikitext into simple text??

I know wikitext gem but it converts the data into html format.

Or does anyone knows how to fetch content from wikipedia using
wikimedia api into simple text format and not in wikitext format?

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



[Rails] Blackbook Errors

2009-06-11 Thread Uthiravel Kuppusamy

Hi friends,

I was getting the following error when i am using Blackbook in console


Blackbook::BadCredentialsError: Must be authenticated to access
contacts.
  from
/home/uthiravel/projects/git/wissr/vendor/plugins/blackbook-1.0.4/lib/blackbook/importer/gmail.rb:45:in
`scrape_contacts'
  from
/home/uthiravel/projects/git/wissr/vendor/plugins/blackbook-1.0.4/lib/blackbook/importer/page_scraper.rb:64:in
`fetch_contacts!'
  from
/home/uthiravel/projects/git/wissr/vendor/plugins/blackbook-1.0.4/lib/blackbook/importer/base.rb:29:in
`import'
  from
/home/uthiravel/projects/git/wissr/vendor/plugins/blackbook-1.0.4/lib/blackbook.rb:32:in
`export'
  from
/home/uthiravel/projects/git/wissr/vendor/plugins/blackbook-1.0.4/lib/blackbook.rb:56:in
`get'
  from
/home/uthiravel/projects/git/wissr/vendor/plugins/blackbook-1.0.4/lib/blackbook.rb:16:in
`get'
  from (irb):2
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Sessions in Rails 2.3?

2009-06-11 Thread Walter McGinnis
I have memcached based sessions (i.e. config/environment.rb
"config.action_controller.session_store = :mem_cache_store") from before
2.3.  Are their any issues I should I keep in mind if I switch to the new
hotness?
Man, that phrase sounds dated!

Cheers,
Walter

2009/6/12 Maurício Linhares 

>
> Currently Rails stores sessions in the browser and this is the most
> scalable solution found until now.
>
> Unless you have a really great idea to build a better session store,
> just use the cookie based one and you're done.
>
> -
> Maurício Linhares
> http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr
>
>
>
> On Thu, Jun 11, 2009 at 12:10 PM, Alex
> Barlow wrote:
> >
> > Hi guys, new here so bonjour..
> >
> > Sorry if this question has been asked, but i had a good look and i'm
> > just generally confused about this  at the moment!
> >
> > ive been learning rails for about 4 months now and im on to sessions
> > and more importantly where there stored, i have "Agile web
> > development" and the lydna screencasts which both talk about sessions.
> >
> > However the agile web development book describes these as
> > ActiveRecordStore, which no longer exists?
> >
> > and Lynda.com is using an old unscalable file system method?
> >
> > Is there a nice guide, long or short someone on the web that shows how
> > to do sessions currently and preferably storing them in a database
> > (mysql)?
> >
> > Cheers, Alex
> >
> > >
> >
>
> >
>

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



[Rails] Nice slideshow

2009-06-11 Thread CiriusMex

Hi, I have to create a page with various slideshows. The page display
diferent places of a property with their data and for each of these
properties display a slideshow with the property photos.
I applied a slideshow but got problems when trying to display more
than one on the same page...

Do someone knows of a simple to apply slideshow that would let me
display more than one instance on the same page?

Thanks for the help.

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



[Rails] Re: 5 minutes to save 25,000 model objects?

2009-06-11 Thread Nick Hoffman

On Jun 11, 11:29 pm, Marnen Laibow-Koser  wrote:
> Nick Hoffman wrote:
>
> [...]
>
> > 25,000 model instances is a lot, but 5 minutes seems too long. Any
> > suggestions for how to speed this up?
>
> > Thanks,
> > Nick
>
> Since you're calling k.save each time through the loop, you're making
> 25,000 database queries.  Don't do that -- instead, build one big insert
> query with all the data (or at least do it in batches of 1000 or so).
> ar-extensions might help here, or there may be another batch insert
> plugin; failing that, building the SQL directly wouldn't be too
> difficult.
>
> In general, a query within a loop is a sure sign that something is
> wrong, or at least inefficient.  Databases work best when you give them
> all the data at once and let them sort out how to handle it.
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> mar...@marnen.org

Hi Marnen. I'm surprised I haven't come across ar-extensions yet. It
looks like the exact solution I need to this problem. Thanks for
recommending it!
-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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: 5 minutes to save 25,000 model objects?

2009-06-11 Thread Nick Hoffman

On Thu, Jun 11, 2009 at 11:24 PM, Ashwin
Mangale wrote:
> Try commenting out the uniqueness constraint and check the result. To be
> fair, the validations listed are fairly standard and can be done before the
> keyword object is created ( client-side using something like ajax + jquery
> ).
>
> Hope this helps.
>
> -Ashwin

Hi Ashwin. I'm finding that the uniqueness constraint doesn't add much
additional processing time.

You're right that the validations are quite standard. However, you
can't rely on input data; it must be validated server-side.

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



[Rails] Re: 5 minutes to save 25,000 model objects?

2009-06-11 Thread Marnen Laibow-Koser

Nick Hoffman wrote:
[...]
> 25,000 model instances is a lot, but 5 minutes seems too long. Any
> suggestions for how to speed this up?
> 
> Thanks,
> Nick

Since you're calling k.save each time through the loop, you're making 
25,000 database queries.  Don't do that -- instead, build one big insert 
query with all the data (or at least do it in batches of 1000 or so). 
ar-extensions might help here, or there may be another batch insert 
plugin; failing that, building the SQL directly wouldn't be too 
difficult.

In general, a query within a loop is a sure sign that something is 
wrong, or at least inefficient.  Databases work best when you give them 
all the data at once and let them sort out how to handle it.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] 5 minutes to save 25,000 model objects?

2009-06-11 Thread Nick

Hi guys. On my laptop, I'm finding that it's taking about 5 minutes to
save 25,000 model instances.

The model has 5 validations, and I'm saving all of the model instances
in a single transaction:
http://pastie.org/509281

25,000 model instances is a lot, but 5 minutes seems too long. Any
suggestions for how to speed this up?

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



[Rails] Re: distributed models

2009-06-11 Thread Maurício Linhares

On Thu, Jun 11, 2009 at 6:30 PM, slava wrote:

> - How does one use ActiveRecord with shared models?

You don't, ActiveRecord is for relational databases only. If your
backend support REST-style web services, you can use ActiveResource
that looks like ActiveRecord.

> - What are the implications of this type of distributed design?
> - Relevant design patterns.

You'll find a discussion and many patterns related to this at
"Patterns of Enterprise Application Architeture" and "Domain Driven
Design" books.

-
Maurício Linhares
http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr

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



[Rails] Re: Overrite ActiveRecord Methods in Plugin

2009-06-11 Thread Maurício Linhares

Never ever override basic methods, if you want to do this, what you
really need is alias_method_chain :)

Imagine that you want to do some logging before and after calling the
:update_attributes method, here's how it would look like:

module ActsAsLoggable

def self.included( base )

base.send( :include, InstanceMethods )
base.alias_method_chain :update_attributes, :acts_as_loggable

end

module InstanceMethods

def update_attributes_with_acts_as_loggable( attributes )
puts "before update attributes"
self.update_attributes_without_acts_as_loggable( attributes )
puts "after update attributes"
end

end

end


-
Maurício Linhares
http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr



On Thu, Jun 11, 2009 at 7:05 PM, Helena
Wotring wrote:
>
> I'm trying to write an acts_as_ plugin for my rails app, and I need to
> override valid? and update_attributes.  No matter what I do, I can't get
> it to call my plugin methods, but it will call my method_missing fine.
>
> -from acts_as_option_record.rb
> module ActsAsOptionRecord
>  def self.included(base)
>    base.extend ClassMethods
>    base.extend InstanceMethods
>  end
>
>  module ClassMethods
>    def acts_as_option_record
>      include ActsAsOptionRecord::InstanceMethods
>      extend ActsAsOptionRecord::ClassMethods
>    end
>
>  end
>
>  module InstanceMethods
>
>    def update_attributes (arguments)
>      debugger
>      #stuff
>    end
>
>    def valid?
>      debugger
>      #more stuff
>    end
>  end
> end
>
> -from init.rb
> ActiveRecord::Base.send(:include, ActsAsOptionRecord)
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

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



[Rails] Re: Mysterious Method added by Scaffold

2009-06-11 Thread Rick

Try this for starters...

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

Rick

On Jun 11, 8:49 pm, doug  wrote:
> I have created a blog by following the instructions detailed in the
> now-famous blog screencast.  Now, I'm attempting to increase my
> knowledge of Rails by accomplishing that same feat in a more hands-on
> way (i.e., without a scaffold).  One perplexing issue that I have
> encountered is that when I created the blog using a scaffold the
> various template files that were created contained several instances
> of mysterious code that looked similar to this:
>
> <%= link_to 'Back', posts_path %>
>
> and this:
>
> <%= link_to 'Edit', edit_post_path(@post) %>
>
> In the above, 'posts_path' and 'edit_post_path' appear to be methods;
> but, I can't find where these methods are defined.  If I insert
> similar code into the blog that I created without a scaffold, Rails
> complains about a missing method.  Can someone please explain what the
> story is on the mysterious methods?
>
> Thanks for any input.
>
>           ... doug
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Mysterious Method added by Scaffold

2009-06-11 Thread Marnen Laibow-Koser

Doug Jolley wrote:
[...]
> In the above, 'posts_path' and 'edit_post_path' appear to be methods;
> but, I can't find where these methods are defined.
[...]

They are defined by your named routes.  Read the routing docs and run 
"rake routes" to see what you've got.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Mysterious Method added by Scaffold

2009-06-11 Thread doug

I have created a blog by following the instructions detailed in the
now-famous blog screencast.  Now, I'm attempting to increase my
knowledge of Rails by accomplishing that same feat in a more hands-on
way (i.e., without a scaffold).  One perplexing issue that I have
encountered is that when I created the blog using a scaffold the
various template files that were created contained several instances
of mysterious code that looked similar to this:

<%= link_to 'Back', posts_path %>

and this:

<%= link_to 'Edit', edit_post_path(@post) %>

In the above, 'posts_path' and 'edit_post_path' appear to be methods;
but, I can't find where these methods are defined.  If I insert
similar code into the blog that I created without a scaffold, Rails
complains about a missing method.  Can someone please explain what the
story is on the mysterious methods?

Thanks for any input.

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



[Rails] Re: Development Question

2009-06-11 Thread Marnen Laibow-Koser

Älphä Blüë wrote:
> 1.  I tested out the VMware box and was able to load my project and even
> work on it.  I received no errors and all tasks seemed to perform well.
> This leads me to believe that as long as all three environments have the
> exact same version of ruby and exact same version of gems (regardless of
> ruby was compiled on windows with ming etc.) that they all should work.
> Is this a correct assumption?

I would think so.

> 
> 2.  I would simply code on my VMWare box but it's a little more sluggish
> becuse it's a virtual box.  I'm also worried that it will crash one day
> and unless I'm doing nightly snapshots or saves, I'll lose work.  

Why are you worried about that?  Linux is a lot less crash-happy than 
Windows.

> Do you
> recommend that I just use this as a test box for my code and keep
> developing on windows where I'm used to developing?

Every time you use Windows, a demon gets his horns. :D

> 
> 3.  Any suggestions on backing up data or crossing over data.  Is there
> a core concept or things to keep in mind when backing up projects after
> you've worked on them?  

At the moment, my project backup is my version control repository (you 
*do* have one of those, right?).

[...]
> 4.  Any other tips that I can use to keep my environment stable and
> efficient?

Stop using Windows, which is neither?

> 
> Many thanks in advance...

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Parsing big XML files - memory issue

2009-06-11 Thread PierreW

Hi all,

Thank you so much for pointing me in the right direction.

I used a REXML SAX2Parser: it solved my problem. It's a bit more code
indeed, but it uses a fraction of the memory and it seems quite fast
to me.

Thanks a lot,
Pierre

On Jun 11, 5:22 pm, Maurício Linhares 
wrote:
> Hi Pierre,
>
> I had a 45~50mb file to parse using Ruby libraries but to no avail,
> the DOM based libraries were slow to death and the SAX based one that
> I tried (libxml-ruby) had some serious memory leaks. Now there's this
> SaxMachine from paul dix that looks usable 
> -http://www.pauldix.net/2009/01/sax-machine-sax-parsing-made-easy.html
>
> As to my problem, I wrote a StAX based parser using Java to get it to
> run in reasonable time :(
>
> -
> Maurício 
> Linhareshttp://codeshooter.wordpress.com/|http://twitter.com/mauriciojr
>
>
>
> On Thu, Jun 11, 2009 at 5:41 AM, PierreW wrote:
>
> > Hello,
>
> > I need to parse two big XML files in a row (30+MB each). I have tried
> > both REXML and Hpricot. They do work. Thing is, with both libraries,
> > the parsing of each file takes a huge amount of memory: more than
> > 700MB each!
>
> > So I was wondering:
> > - is it normal that parsing a 30MB file takes 700MB of memory? Could
> > it be that something is wrong with the file? Is there an alternative
> > way to deal with such big files?
> > - is there a way to force the release of the memory when I don't need
> > the file anymore? At the moment it is not released instantly after the
> > first file, so I end up with 1.5GB memory use.
>
> > I have reduced the code to the minimum to isolate the memory issue:
>
> > xml = File.read("myfile.xml")
> > doc = REXML::Document.new(xml) or doc = Hpricot.XML(xml)
> > doc = nil
>
> > and repeat with the second file.
>
> > Also, I tried libxml in case. I get an error message that I can't
> > explain:
> > LibXML::XML::Error (Fatal error: Input is not proper UTF-8, indicate
> > encoding !  yet the file is UTF-8 as far as I can tell.
>
> > Thanks a lot for your help.
> > Pierre
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Trigger an Ajax update from an external JS ?

2009-06-11 Thread Julien J.F.

bill walton wrote:
> Hi Julien,
> 
> On Thu, 2009-06-11 at 22:51 +0200, Julien J.F. wrote:
>> forgot to add that the game is passing parameters to the JS functions, 
>> and i need to figure out a way to get these back to rails too...
> 
> Rails is a framework for building web-based, database-driven
> applications.  I'm not sure, from what you described, that Rails is what
> you're looking for.
> 
> Other than displaying the html page and associated JS, what role,
> exactly, does Rails play in the application you're developing?  From
> what you've written I don't see where Rails would naturally enter the
> picture.  When you say 'get these back to Rails', what happens then?
> 
> Bill

Well for this particular prototype i'm working on, not much i must 
say...

Ultimately though, the projects we have on the line would greatly 
benefit from rails, but if we go that route, i need to be able to rely 
solely on rails for all the business logic, and a lot of it deals with 
elements/events from the game component.
Eventually i hope to be able to handle 3d objects much like dom elements 
of the page.

Anyway, right now i'm merely trying to find out how to establish a solid 
2 way communication between the game engine and a rails back-end (the 
game engine can also execute internal code, by calling a JS function of 
its wrapper).
But i'm failing to see if this can be handled purely in rails, or if 
i'll need to write some vanilla JS to act as a sort of middleware layer.

I really hope i can pull it off somehow, cause i really don't wanna 
spend the next 6 months writing php code... ^^
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Printing the contents of a DIV

2009-06-11 Thread bill walton

Hi,

On Fri, 2009-06-12 at 00:42 +0200, Älphä Blüë wrote:
> Bill that was really good information and detailed - many thanks!  I was 
> actually looking for something like this about 3 days ago but put it on 
> the backburner.
> 
> I'm bookmarking the thread for later use.
> 
> Thanks.

You're welcome.  Glad you found it helpful.

Best regards,
Bill


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



[Rails] Re: Printing the contents of a DIV

2009-06-11 Thread Älphä Blüë

Bill that was really good information and detailed - many thanks!  I was 
actually looking for something like this about 3 days ago but put it on 
the backburner.

I'm bookmarking the thread for later use.

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



[Rails] Development Question

2009-06-11 Thread Älphä Blüë

I have the following:

Windows Vista (primary machine)
-- 1.9.1-p129 and all gems I currently need
-- using netbeans IDE 6.5
-- have a primary project being developed

Ubuntu 9.x (VMWare box on primary machine)
-- 1.9.1-p129 and all gems I currently need
-- using netbeans IDE 6.5
-- has a copied version of the primary project being developed

Ubuntu Hardy (VPS - main website hosted through slicehost)
-- 1.9.1-p129 and all gems I currently need
-- no projects uploaded or tested yet


Questions


1.  I tested out the VMware box and was able to load my project and even
work on it.  I received no errors and all tasks seemed to perform well.
This leads me to believe that as long as all three environments have the
exact same version of ruby and exact same version of gems (regardless of
ruby was compiled on windows with ming etc.) that they all should work.
Is this a correct assumption?

2.  I would simply code on my VMWare box but it's a little more sluggish
becuse it's a virtual box.  I'm also worried that it will crash one day
and unless I'm doing nightly snapshots or saves, I'll lose work.  Do you
recommend that I just use this as a test box for my code and keep
developing on windows where I'm used to developing?

3.  Any suggestions on backing up data or crossing over data.  Is there
a core concept or things to keep in mind when backing up projects after
you've worked on them?  Do you backup the entire project?  Or, just
specific folders?  If the latter, which?

4.  Any other tips that I can use to keep my environment stable and
efficient?

Many thanks in advance...
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Ruby 1.9.1-p129 fails the configure on OSX 10.5.7

2009-06-11 Thread Rick

I'm running:

Mac OSX V 10.5.7
1.25 GHz PPC G4

I've successfully built ruby-1.8.[67]p"72-160", ruby-1.9.1p"0-129",
and ruby-1.9.2dev(many versions).

cd ruby-1...
./configure --prefix=/opt/... --enable-pthread
make
make install

Is it possible your "autoconf" step is tripping you up?  Or is it
possible that there's a problem with the 10.5.7 intel build?  I
seriously doubt it's the second as it's been several years since the
intel intro and I'm definitely in the minority as a ppc developer.

Rick

On Jun 11, 5:21 pm, heimdull  wrote:
> Tried stable-snapshot and snapshot both has the same issue
>
> Just as a test I tried 1.8.7-p160 and that works and installs fine (./
> configure, make, make install)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Ruby 1.9.1-p129 fails the configure on OSX 10.5.7

2009-06-11 Thread Aaron Turner

On Thu, Jun 11, 2009 at 2:03 PM, Freddy Andersen wrote:
>
> cd ruby-1.9.1-p129
> autoconf
> ./configure --program-suffix=19
>
> checking whether ELF binaries are produced... no
> checking whether OS depend dynamic link works... In file included
> from /usr/local/include/fuse/fuse.h:26,
>                 from :1:
> /usr/local/include/fuse/fuse_common.h:32:2: error: #error Please add -
> D_FILE_OFFSET_BITS=64 to your compile flags!
> In file included from /usr/local/include/fuse/fuse.h:777,
>                 from :1:
> /usr/local/include/fuse/fuse_compat.h:68:24: error: sys/statfs.h: No
> such file or directory
> yes
> checking for if make is GNU make... yes
> checking for nroff... /usr/bin/nroff
> creating config.h
> configure: creating ./config.status
> config.status: creating Makefile
>
>
> Not sure why this is failing... I tried this configure string too but
> with no luck
>
> ./configure --program-suffix=19 --enable-shared --enable-pthread
> CFLAGS=-D_FILE_OFFSET_BITS=64

./configure --with-static-linked-ext --enable-pthread --enable-shared
--with-ruby-version=full --program-suffix=1.9

Works just fine for me w/ 10.5.7 on Intel.  I have a bunch of things
(including  gcc 4.1) installed via MacPorts though.

usually i would:

CFLAGS=-D_FILE_OFFSET_BITS=64 ./configure ...

-- 
Aaron Turner
http://synfin.net/
http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & Windows
Those who would give up essential Liberty, to purchase a little temporary
Safety, deserve neither Liberty nor Safety.
-- Benjamin Franklin

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



[Rails] Re: Printing the contents of a DIV

2009-06-11 Thread bill walton

Hi Darren,

On Thu, 2009-06-11 at 12:23 -0700, Ruby on Rails: Talk wrote:
> Hi
> 
> Is there any way to be able to get a function (or something?!) to
> print the contents of a DIV without loading the div into it's own
> window etc?
> 
> I've googled like crazy but seem to be asking the impossible. Any
> ideas?

Google "CSS print stylesheet example".  Hassan and Marnen are correct.
The links you'll get from the search above will get you to a point where
you understand what they said ;-)

Basically...

In the  section of your layout (typically application.rhtml), you
specify the stylesheets you want to use and, optionally, which 'media'
they're to be used for.  The choices are screen, print, or all.  Here's
an example from one of mine.

<%= stylesheet_link_tag 'application', :media => 'screen' %>
<%= stylesheet_link_tag 'print', :media => 'print' %>

These helper methods result in the application.css file being used to
style pages sent to the screen, and the print.css file being used to
style pages sent to the printer.

Put the two lines above in the head section of your layout.  Create
an .rhtml view with the following.


  
I'm your screen buddy!
  
  
I'm your print buddy!
  


Now create the two stylesheets.

application.css
---
div#for_screen_display {
  display:block;
}

div#for_print_display {
  display:none;
}
--

print.css
--
div#for_screen_display {
  display:none;
}

div#for_print_display {
  display:print;
}

When the browser loads the page, it notes that you've specified
different stylesheets for different media and takes care of the rest.

HTH,
Bill


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



[Rails] Overrite ActiveRecord Methods in Plugin

2009-06-11 Thread Helena Wotring

I'm trying to write an acts_as_ plugin for my rails app, and I need to
override valid? and update_attributes.  No matter what I do, I can't get
it to call my plugin methods, but it will call my method_missing fine.

-from acts_as_option_record.rb
module ActsAsOptionRecord
  def self.included(base)
base.extend ClassMethods
base.extend InstanceMethods
  end

  module ClassMethods
def acts_as_option_record
  include ActsAsOptionRecord::InstanceMethods
  extend ActsAsOptionRecord::ClassMethods
end

  end

  module InstanceMethods

def update_attributes (arguments)
  debugger
  #stuff
end

def valid?
  debugger
  #more stuff
end
  end
end

-from init.rb
ActiveRecord::Base.send(:include, ActsAsOptionRecord)
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Trigger an Ajax update from an external JS ?

2009-06-11 Thread bill walton

Hi Julien,

On Thu, 2009-06-11 at 22:51 +0200, Julien J.F. wrote:
> forgot to add that the game is passing parameters to the JS functions, 
> and i need to figure out a way to get these back to rails too...

Rails is a framework for building web-based, database-driven
applications.  I'm not sure, from what you described, that Rails is what
you're looking for.

Other than displaying the html page and associated JS, what role,
exactly, does Rails play in the application you're developing?  From
what you've written I don't see where Rails would naturally enter the
picture.  When you say 'get these back to Rails', what happens then?

Bill


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



[Rails] Re: Recursive partial wasted my 2 hours

2009-06-11 Thread Frederick Cheung



On Jun 11, 7:37 pm, Sam Kong  wrote:
> Hi,
>
> When I called a page, the server choked like frozen.
> I checked it with 'top' command and HDD(wa) was 95%.
> There's no error or suspicious log.
>
> After wasting 2 hours, I found that a partial called it self.
> In _a.html.erb
> <%= render :partial => "a" %>
>
> Can rails detect such a mistake and stop proceeding and report it?
>
In the absolute is this not the same as trying to solve the halting
problem ? (which has been proved to be unsolvable)

Fred

> Thanks.
>
> Sam
> --
> 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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Problem Logging in to site with two names

2009-06-11 Thread paulpl...@gmail.com

I have a wierd website setup, because my boss doesn't want to change
who hosts our email server.

My website is hosted on site5, and has a domain name registered with
them (www.mysite1.com).
www.mysite2.net is registered somewhere else and resolves to www.mysite1.com.

When I try to login to www.mysite1.com I have no problems.
When I try to login to www.mysite2.net, I get an error from the
verify_authenticity_token method.

I'm pretty sure I'm getting this because the session isn't being
loaded from the request, becuase I need to set some configuration in
config.action_controller.session = { in my environment.rb file.

I use :active_record_store

I've tried digging around in the abstract_store.rb file to see if I
could just hardcode something into the load! method so that it would
make sure to load authenticity_token from the request into the
session.

def load!
stale_session_check! do
  id, session = @by.send(:load_session, @env)
  (@env[ENV_SESSION_OPTIONS_KEY] ||= {})[:id] = id
  replace(session)
  @loaded = true
end
  end

Any suggestions would be great.

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



[Rails] distributed models

2009-06-11 Thread slava

Hello,
I am designing a web application that has several tiers including a
Flex client, Rails server and SAP back-end. The application is an
extension of functionality offered by SAP system. SOAP based web
services are used communicate with the back-end.
I am pondering on the implications of the fact that some of my data
models are likely to be in the back-end and some in the Rails
application and some are distributed (shared) between Rails and the
back-end. I would appreciate any pointers toward relevant knowledge on
this subject and if anyone tried something similar with Rails.
Some of  the questions I have to find answers to are:
- How does one use ActiveRecord with shared models?
- What are the implications of this type of distributed design?
- Relevant design patterns.

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



[Rails] Re: Redefining rename_column?

2009-06-11 Thread Marnen Laibow-Koser

Paul Lynch wrote:
> Some of the tables in our system hold data entered by users of the web
> site.  I am trying to stop one of us (developers) from shooting
> ourselves in the foot by accidentally modifying those tables in a way
> that would lose data.

This is almost certainly a bad idea.  You should not be sandboxing the 
developers -- they should have full access to change what needs to be 
changed.  If you can't trust your developers to use that access wisely, 
fire them.  If the data is that important, back it up.  If developers 
really shouldn't have that level of access to the DB at all, then don't 
grant those privileges to the relevant DB user.

But hackish solutions like what you're talking about will just make the 
developers' lives harder for no good reason.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.orv
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Ruby 1.9.1-p129 fails the configure on OSX 10.5.7

2009-06-11 Thread heimdull

Tried stable-snapshot and snapshot both has the same issue

Just as a test I tried 1.8.7-p160 and that works and installs fine (./
configure, make, make install)


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



[Rails] Re: Candidate for RJS?

2009-06-11 Thread Tyler Knappe

Xavier Noria wrote:
> On Thu, Jun 11, 2009 at 10:19 PM, Tyler
> Knappe wrote:
> 
> If the real code is different please paste it.

Here is the code:

session[:next_week] = Date.today.cweek

render :update do |page|
page["Current_Week_div_1"].replace_html 
session[:next_week].to_s
page["Week_div"].replace_html session[:next_week].to_s
page["test_div_1"].replace_html "Test 1"
page["test_div_2"].replace_html "Test 2"
page["test_div_3"].replace_html "Test 3"
page["test_div_4"].replace_html "Test 4"
page["test_div_5"].replace_html "Test 5"
page["test_div_6"].replace_html "Test 6"
page["test_div_7"].replace_html "Test 7"
for i in 0..23 do
for j in 0..6 do
if 
(Date.today.beginning_of_week.to_time.to_i + ( j * 86400) + ( i * 3600) 
+  ((session[:next_week] - session[:current_week]) * 7 * 86400 )) < 
(session[:lab_object].end_time.to_time.to_i) && 
(Date.today.beginning_of_week.to_time.to_i + ( j * 86400) + ( i * 3600) 
+ ((session[:next_week] - session[:current_week]) * 7 * 86400 )) > 
(session[:lab_object].start_time.to_time.to_i - 3600)
page["test_div"].replace_html 
"Checked Out"
else
page["test_div"].replace_html 
"Available"
end
end
end
end

Executing this code only updates a single element.

BEFORE:
 Monday  Tuesday Wednesday Thursday  Friday Saturday Sunday
0:00 Available Available Available Checked Out Checked Out Checked Out 
Checked Out
1:00 Available Available Available Checked Out Checked Out Checked Out 
Checked Out
[this continues for an entire week]

AFTER:
 Monday  Tuesday Wednesday Thursday  Friday Saturday Sunday
0:00 Checked Out Available Available Checked Out Checked Out 
Checked Out Checked Out
1:00 Available Available Available Checked Out Checked Out Checked Out 
Checked Out
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Printing the contents of a DIV

2009-06-11 Thread Ruby on Rails: Talk

This sounds excellent!

Just need to work out how to do it.

On Jun 11, 9:59 pm, Hassan Schroeder 
wrote:
> On Thu, Jun 11, 2009 at 1:49 PM, Ruby on Rails:
>
> Talk wrote:
> > I'I have a number of DIV's on a page. One of which contains a calendar
> > or events. Rather than have to reload a page with just the calendar on
> > it (to allow for printing), it would seem easier to find a way to
> > click a button and only the div containing the calendar will print.
>
> If it's always the same, and you never want to print everything else
> on the page, a simple print style sheet would do.
>
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Ruby 1.9.1-p129 fails the configure on OSX 10.5.7

2009-06-11 Thread Freddy Andersen

cd ruby-1.9.1-p129
autoconf
./configure --program-suffix=19

checking whether ELF binaries are produced... no
checking whether OS depend dynamic link works... In file included
from /usr/local/include/fuse/fuse.h:26,
 from :1:
/usr/local/include/fuse/fuse_common.h:32:2: error: #error Please add -
D_FILE_OFFSET_BITS=64 to your compile flags!
In file included from /usr/local/include/fuse/fuse.h:777,
 from :1:
/usr/local/include/fuse/fuse_compat.h:68:24: error: sys/statfs.h: No
such file or directory
yes
checking for if make is GNU make... yes
checking for nroff... /usr/bin/nroff
creating config.h
configure: creating ./config.status
config.status: creating Makefile


Not sure why this is failing... I tried this configure string too but
with no luck

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



[Rails] Re: Printing the contents of a DIV

2009-06-11 Thread Hassan Schroeder

On Thu, Jun 11, 2009 at 1:49 PM, Ruby on Rails:
Talk wrote:

> I'I have a number of DIV's on a page. One of which contains a calendar
> or events. Rather than have to reload a page with just the calendar on
> it (to allow for printing), it would seem easier to find a way to
> click a button and only the div containing the calendar will print.

If it's always the same, and you never want to print everything else
on the page, a simple print style sheet would do.

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

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



[Rails] Re: Trigger an Ajax update from an external JS ?

2009-06-11 Thread Julien J.F.

forgot to add that the game is passing parameters to the JS functions, 
and i need to figure out a way to get these back to rails too...

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

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



[Rails] Re: Printing the contents of a DIV

2009-06-11 Thread Ruby on Rails: Talk

Hi

No :( Sorry.

I'I have a number of DIV's on a page. One of which contains a calendar
or events. Rather than have to reload a page with just the calendar on
it (to allow for printing), it would seem easier to find a way to
click a button and only the div containing the calendar will print.

I've got close to understanding it with the following link:

http://lloydi.com/blog/2006/03/21/how-to-print-selective-sections-of-a-web-page-using-css-and-dom-scripting-2/

But I wonder if there is something easier?

Cheers

Darren


On 11 June, 21:29, Xavier Noria  wrote:
> On Thu, Jun 11, 2009 at 9:23 PM, Ruby on Rails:
>
> Talk wrote:
> > Is there any way to be able to get a function (or something?!) to
> > print the contents of a DIV without loading the div into it's own
> > window etc?
>
> > I've googled like crazy but seem to be asking the impossible. Any
> > ideas?
>
> I am not sure I understand what you mean, but just in case I am lucky,
> perhaps you are looking for factoring out the DIV into a partial?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Redefining rename_column?

2009-06-11 Thread Paul Lynch

Some of the tables in our system hold data entered by users of the web
site.  I am trying to stop one of us (developers) from shooting
ourselves in the foot by accidentally modifying those tables in a way
that would lose data.  My plan is to capture calls to table change
commands, record some of them (e.g. add_column) so that they can be
played back later on the production database, and prohibit others
(e.g. remove_column).

On Jun 11, 4:28 pm, Marnen Laibow-Koser  wrote:
> Paul Lynch wrote:
> > I would like to prevent rename_column from working in certain
> > circumstances, so I was trying to redefine rename_column.
>
> [...]
>
> Can I ask what you're trying to accomplish here?  In general, it seems
> to me that preventing something like this from working will probably be
> confusing to anyone maintaining the code.
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> mar...@marnen.org
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] RESTful routes problem when updating record.

2009-06-11 Thread lyntaff

I get an error when trying to update a record when using a HTTP
request PUT method from a form complying with the RESTful routing for
the resource.

The error is: Only get and post requests are allowed.

Has anybody come accross this before?

Hope somebody can 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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Candidate for RJS?

2009-06-11 Thread Xavier Noria

On Thu, Jun 11, 2009 at 10:19 PM, Tyler
Knappe wrote:

> Right, I understand the MVC logic.  However, even removing the logic
> from the loop only renders a single time; the first element.  If I swap
> how the loop is performed to loop over the :update then I get an error
> about attempting more than one render per call.  The same is also true
> of redirects.  Is there a better way of doing this, or will RJS fix the
> problem?  Can it perform more than one render?

That code *is* using RJS, that's what provides you the page object. It
is inline RJS instead of RJS in its own file, but it is RJS.

Render can happen only once, but several calls to the page object in
the same render do not account for serveral renders.

Your code uses a single ID, if you modify only one element, that's what you get.

If the real code is different please paste it.

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



[Rails] Re: Printing the contents of a DIV

2009-06-11 Thread Xavier Noria

On Thu, Jun 11, 2009 at 9:23 PM, Ruby on Rails:
Talk wrote:

> Is there any way to be able to get a function (or something?!) to
> print the contents of a DIV without loading the div into it's own
> window etc?
>
> I've googled like crazy but seem to be asking the impossible. Any
> ideas?

I am not sure I understand what you mean, but just in case I am lucky,
perhaps you are looking for factoring out the DIV into a partial?

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



[Rails] Re: Redefining rename_column?

2009-06-11 Thread Marnen Laibow-Koser

Paul Lynch wrote:
> I would like to prevent rename_column from working in certain
> circumstances, so I was trying to redefine rename_column.
[...]

Can I ask what you're trying to accomplish here?  In general, it seems 
to me that preventing something like this from working will probably be 
confusing to anyone maintaining the code.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Candidate for RJS?

2009-06-11 Thread Tyler Knappe

Xavier Noria wrote:
> On Thu, Jun 11, 2009 at 7:59 PM, Tyler
> Knappe wrote:
> 
>>                        for j in 0..6 do
>>
>> ==
>>
>> When the function is called, it only replaces a single element out of
>> the loop (the first).  Is there a way to render all elements?  It sounds
>> like RJS is the way to do this (http://www.ruby-forum.com/topic/135158)
>> but I still don't see how.
> 
> It is not a good pratice to use render :update like that. When the RJS
> is more than a one-liner, say, it is more clean to extract that to its
> own RJS template. Because RJS belongs to the V in MVC.
> 
> On the other hand the idea of the loop + calls to page...something is
> correct. In your example the ID of the element is always the same
> though. Knowing this, you could for example simplify the code like
> eliminating the conditional to get a wrong but working version, and
> after that add all the logic.

Right, I understand the MVC logic.  However, even removing the logic 
from the loop only renders a single time; the first element.  If I swap 
how the loop is performed to loop over the :update then I get an error 
about attempting more than one render per call.  The same is also true 
of redirects.  Is there a better way of doing this, or will RJS fix the 
problem?  Can it perform more than one render?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Trigger an Ajax update from an external JS ?

2009-06-11 Thread Julien Julien

thanks for taking the time to answer bill, my post was indeed vague i 
must reckon, i'll try to clear things up.


bill walton wrote:

> For starters, what's a 'system component'?  And whatever it is, is this
> the thing that you want go get loaded when the user takes some action?

well it's actually a 3d game engine plugin (s3dplayer from 
www.stonetrip.com FYI), so it's actually a system-wide component taht 
relies on a JS to be loaded into the browser on page load.
Once loaded it should remain on the page, the user interacts with it, 
and under certain circumstances, it will fire up JS functions to update 
elements of the DOM.

>> On defined user actions, 
> 
> So we're talking about clicking a link or a button?

Well no, and that's the tricky part, thanks for pointing this out.
The 'triggering' action would actually come from the user interacting 
with the game engine component, as i explained.
The component can access the system to open a URL, so I use this to call 
JS functions, with _self as the target, so the page doesn't reload.


>> this component will call a definable JS method,
> 
> Definable? As in 'not known until run-time'?

Well sort of (cf. my previous response), and that's precisely where i 
get confused.
When using link_to_function, rails knows about an actual element that 
will act as a trigger (form field, some text etc), here the triggers are 
just function calls to the JS layer of the client.


>> that i'd like to act in a link_remote_to fashion, to update some
>> elements of the page.
> 
> 
> link_to_remote(...) makes an XHR / XMLHttpRequest to a controller method
> on the server.  In Rails you have several options WRT constructing the
> JS response the client expects.  The easiest is an RJS template that
> replaces existing html element(s) on the page.
> 
> I highly recommend Cody Fauser's O'Reilly Shortcut: RJS Templates.  Best
> $10 I've spent on Rails so far.
> 
> link_to_function(...) calls a JS function you specify in the call.

Well, I'd really like to be able to specify some DOM behavior as soon as 
the triggering user-action takes place (like displaying a spinner 
without relying on a JS callback), that's what i meant by 
"link_to_function fashion", i'm thinking i might have overlooked the 
traditionnal routes way though...


hope this makes more sense.

cheers

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

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



[Rails] Re: Printing the contents of a DIV

2009-06-11 Thread Marnen Laibow-Koser

Ruby on Rails: Talk wrote:
> Hi
> 
> Is there any way to be able to get a function (or something?!) to
> print the contents of a DIV without loading the div into it's own
> window etc?
[...]

Most browsers these days understand CSS @media directives, so use a 
print stylesheet to turn off display on all other elements.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Redefining rename_column?

2009-06-11 Thread Paul E. G. Lynch

I would like to prevent rename_column from working in certain
circumstances, so I was trying to redefine rename_column.  However, it
seems that the adapter's definition loads afterward and wipes out what
I put in.  I have successfully overridden add_column, so I am
confident that I have the definition in the right module.  Is there a
way to force the database adapter to load, so I can override is
(adapter-specific) rename_column?   (I guess I might be able to
override each database-specific rename_column, but I don't like that
solution.)

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



[Rails] Ruby 1.9.1 and Rails on Ubuntu

2009-06-11 Thread Älphä Blüë

After successfully compiling 1.9.1 and updating the gem environment on
my vbox, I performed the following:

sudo gem install capistrano rails test-unit rspec-rails rake-compiler
sqlite3-ruby hectoregm-mysql-ruby gem_plugin

1) cd /usr/local/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5/ext/http11
2) sudo vi / mate on http11.c and:
replace line 77 with
for(ch = RSTRING_PTR(f), end = ch + RSTRING_LEN(f); ch < end; ch++) {
replace line 172 with
colon = strchr(RSTRING_PTR(temp), ':');
replace line 174 with
rb_hash_aset(req, global_server_name, rb_str_substr(temp, 0, colon -
RSTRING_PTR(temp)));
replce line 176,177
rb_str_substr(temp, colon - RSTRING_PTR(temp)+1,
RSTRING_LEN(temp)));
replace lines 298 299
dptr = RSTRING_PTR(data);
dlen = RSTRING_LEN(data);
3) save the file, close the vi / textmate
4) sudo ruby extconf.rb && sudo make && sudo make install
5) cd ../../lib/mongrel
(or the full path
"/usr/local/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5/lib/mongrel"
6) mate / sudo vi handlers.rb
7) fix the case statements in
On lines 208-212, change instances of ": false" to "then false"
8) sudo gem install gem_plugin (else mongrel may hang)
done!

This gives me:

Capistrano
rails 2.3.2
rake-compiler
gem_plugin
mysql 2.8
sqlite3
test-unit
Mongrel 1.1.5

..

Are there any other gems I will need to consider on my vbox and/or any
gems that might need to be installed on my VPS that aren't listed here?

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



[Rails] Re: Restful routing question

2009-06-11 Thread Mario Gr

Yep..  I have done both. This is the output from my rake routes.

discard_contents_project POST   /projects/:id/discard_contents(.:format) 
{:controller=>"projects", :action=>"discard_contents"}

It seems like it should be a valid route...

I found it:  :method => :post. The method needed to be explicitly set 
since the route only allows the path if the request method is post.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Printing the contents of a DIV

2009-06-11 Thread Ruby on Rails: Talk

Hi

Is there any way to be able to get a function (or something?!) to
print the contents of a DIV without loading the div into it's own
window etc?

I've googled like crazy but seem to be asking the impossible. Any
ideas?

Thanks

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



[Rails] Grouped sums -- was: Re: Compare timestamps

2009-06-11 Thread Bruno Sousa

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

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



[Rails] Re: Trigger an Ajax update from an external JS ?

2009-06-11 Thread bill walton

Hi Julien,

On Thu, 2009-06-11 at 20:24 +0200, Julien Julien wrote:
> I'm researching a project that uses a system component loaded on the
> page through a custom JS file.

I'm having a little trouble understanding exactly what you're trying to
do.  I'll take a stab, but in case i totally misunderstand you, i'll ask
a few questions that, if my response is no help, may make it easier to
ask again.

For starters, what's a 'system component'?  And whatever it is, is this
the thing that you want go get loaded when the user takes some action?

> On defined user actions, 

So we're talking about clicking a link or a button?

> this component will call a definable JS method,

Definable? As in 'not known until run-time'?

> that i'd like to act in a link_remote_to fashion, to update some
> elements of the page.


link_to_remote(...) makes an XHR / XMLHttpRequest to a controller method
on the server.  In Rails you have several options WRT constructing the
JS response the client expects.  The easiest is an RJS template that
replaces existing html element(s) on the page.

I highly recommend Cody Fauser's O'Reilly Shortcut: RJS Templates.  Best
$10 I've spent on Rails so far.

link_to_function(...) calls a JS function you specify in the call.

Write back if that doesn't help.

Best regards,
Bill




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



[Rails] Recursive partial wasted my 2 hours

2009-06-11 Thread Sam Kong

Hi,

When I called a page, the server choked like frozen.
I checked it with 'top' command and HDD(wa) was 95%.
There's no error or suspicious log.

After wasting 2 hours, I found that a partial called it self.
In _a.html.erb
<%= render :partial => "a" %>

Can rails detect such a mistake and stop proceeding and report it?

Thanks.

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

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



[Rails] Trigger an Ajax update from an external JS ?

2009-06-11 Thread Julien Julien

I'm researching a project that uses a system component loaded on the
page through a custom JS file.

On defined user actions, this component will call a definable JS method,
that i'd like to act in a link_remote_to fashion, to update some
elements of the page.

I'm just getting started with RAILS, and this doesn't really conform to
the typical ajax updates i've been reading on, so i'm a bit confused on
how to actually implement this functionnality.

Should i defer the component to a vanilla JS script on the page, that
will take care of making a proper AJAX request to the back end ?
This seems a bit convoluted, and chances are i'm overlooking
something...

Any hints ?

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

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



[Rails] Re: Candidate for RJS?

2009-06-11 Thread Xavier Noria

On Thu, Jun 11, 2009 at 7:59 PM, Tyler
Knappe wrote:

> I have a function in my controller that loops over a div tag replacing
> some text based up an updated variable set by the user.
>
> Code:
>
> = Controller ==
>
> render :update do |page|
>
>              for i in 0..23 do
>                        for j in 0..6 do
>                                if ([date calculation done here])
>                                   page["test_div"].replace_html
> "Checked Out"
>                                else
>                                        page["test_div"].replace_html
> "Available"
>                                end
>                        end
>                end
> end
>
> ==
>
> When the function is called, it only replaces a single element out of
> the loop (the first).  Is there a way to render all elements?  It sounds
> like RJS is the way to do this (http://www.ruby-forum.com/topic/135158)
> but I still don't see how.

It is not a good pratice to use render :update like that. When the RJS
is more than a one-liner, say, it is more clean to extract that to its
own RJS template. Because RJS belongs to the V in MVC.

On the other hand the idea of the loop + calls to page...something is
correct. In your example the ID of the element is always the same
though. Knowing this, you could for example simplify the code like
eliminating the conditional to get a wrong but working version, and
after that add all the logic.

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



[Rails] [ANN] ri_cal 0.6.2 Released

2009-06-11 Thread Rick DeNatale

ri_cal version 0.6.2 has been released!

* 
* 

A new Ruby implementation of RFC2445 iCalendar.

The existing Ruby iCalendar libraries (e.g. icalendar, vpim) provide
for parsing and generating icalendar files,
but do not support important things like enumerating occurrences of
repeating events.

This is a clean-slate implementation of RFC2445.

A Google group for discussion of this library has been set up
http://groups.google.com/group/rical_gem

Changes:

### 0.6.2 - 11 June 2009
 * Fixed http://rick_denatale.lighthouseapp.com/projects/30941-ri_cal/tickets/12
  export-failure-for-unbounded-tzinfo-timezone
### 0.6.1 - 6 June 2009
 * Fixed problem with file which loads activesupport for the rake
spec:with_activesupport task, it now
   requires >=2.2 instead of <=2.2 - Thanks to Paul Scott-Murphy for
finding this.
### 0.6.0 - 5 June 2009
 Time for a minor version bump.
 * Improved overall enumeration performance bypassing most of the
effects of the poor performance of Ruby's DateTime class.
 * Added a framework for performance monitoring during development.
   - New performance directory with subdirs for code to be monitored
for performance (subjects)
   - New script files:
script/benchmark_subject runs a ruby benchmark on one
performance subject
script/profile_subject runs ruby-prof for a subject and puts a
kcachegrind compatible calltree in the performance_data directory.
   - New rake tasks:
performance:benchmark runs benchmarks against all subjects in
the performance directory and produces a consolidated output file in
performance_data/benchmarks.out
performance:profile runs script/profile_subject against all
subjects in the performance directory.
### 0.5.3 - 1 June, 2009
 * Improved performance of time zone enumeration, TimeZonePeriod now
caches occurrences
 * Added a profiling directory which contains ruby programs which
benchmark and/or profile performance
### 0.5.2
 * Fixed http://rick_denatale.lighthouseapp.com/projects/30941/tickets/11
   Export folding is not UTF-8 Safe
### 0.5.1
 * Fixed README to acknowledge release on RubyForge
### 0.5.0 rubyforge release candidate Tue May 26 10:26:43 2009 -0400
 * Added OccurrenceEnumerator#zulu_occurrence_range
### 0.0.11 Sat May 23 18:24:57 2009 -0400
 * Fixed http://rick_denatale.lighthouseapp.com/projects/30941/tickets/5
 * Fixed http://rick_denatale.lighthouseapp.com/projects/30941/tickets/9
### 0.0.10
 * Fixed http://rick_denatale.lighthouseapp.com/projects/30941/tickets/8
### 0.0.9
  * Fixed http://rick_denatale.lighthouseapp.com/projects/30941/tickets/4
Missing comparison methods in PropertyValue::Date
  * Fixed http://rick_denatale.lighthouseapp.com/projects/30941/tickets/6
Type of dtstart and dtend (DATE or DATETIME) now preserved on enumeration
### 0.0.8
  * Fixed http://rick_denatale.lighthouseapp.com/projects/30941-ri_cal/tickets/1
EXDATE and RDATE now pick up the timezone from DateTime, Time, and
TimeWithZone values
  * Fixed http://rick_denatale.lighthouseapp.com/projects/30941/tickets/2
Missing arithmetic methods in PropertyValue::Date
  * Fixed http://rick_denatale.lighthouseapp.com/projects/30941/tickets/3
   Components with no recurrence rules or rdate properties failed
on enumeration, they now
   will enumerate a single occurrence
### 0.0.7
 * Fixed a bug relating to properly recognizing ActiveRecord::TimeWithZone
 * DATETIME propertyvalues will now return an instance of TimeWithZone
instead of DateTime when
   activesupport is present, and it is appropriate. See the README for details
### 0.0.6
 * Added rake tasks to run specs with either the tzinfo gem or
activesupport (<=2.2)
 * Default rake task now runs both of these
### 0.0.5
 * Fixed a bug in occurrence enumeration reported by paulsm on github
### 0.0.4
 * Fixed a bug in imported timezones reported by paulsm on github
### 0.0.3
 * Added tzid method to Ruby Time and DateTime instances, and to
ActiveRecord::TimeWithZone if it is defined this method is used to
determine the desired
timezone when an instance of one of these classes is given as the
value of a datetime property.  If the tzid is nil then the default
tzid is used,
if it is set to :floating then the property will be a floating time.
 * Removed the ability to pass an array with a tzid string and a
date-time since the above made it unnecessary
 * The ruby datetime property returned from the ruby_value method on
the DateTime property will return an instance of ::DateTime with:
   ** The proper utc offset
   ** The tzid set to the right tzid
 * Made exdate/rdate building possible
 * Added a default_tzid attribute to the Calendar component, if this
attribute is not set for a particular calendar it will delegate to the
default set
for the DateTime property class.
 * Added fix patches from
   ** http://github.com/kjwierenga/ri_cal
   ** http://github.com/wesmaldonado/ri_cal

### 0.0.2
 * Fixed gemspec
## 0.0.1

* 

[Rails] Candidate for RJS?

2009-06-11 Thread Tyler Knappe

I have a function in my controller that loops over a div tag replacing
some text based up an updated variable set by the user.

Code:

= Controller ==

render :update do |page|

  for i in 0..23 do
for j in 0..6 do
if ([date calculation done here])
   page["test_div"].replace_html
"Checked Out"
else
page["test_div"].replace_html
"Available"
end
end
end
end

==

When the function is called, it only replaces a single element out of
the loop (the first).  Is there a way to render all elements?  It sounds
like RJS is the way to do this (http://www.ruby-forum.com/topic/135158)
but I still don't see how.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] What is RubySpec and why should you care? http://bit.ly/CavJE

2009-06-11 Thread LJMecca

What is RubySpec? -- An executable definition of the Ruby programming
language using RSpec-style specs.

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



[Rails] Grouped sums -- was: Re: Compare timestamps

2009-06-11 Thread Marnen Laibow-Koser

Bruno Sousa wrote:
> Okay,
> another issue:
> There are persons with the same names. I need to group them by their 
> names and add their age(the ones that have same name).
[...]

This is best done with SQL aggregate functions, which ActiveRecord 
abstracts as Calculations.  From memory, you probably want something 
like

Person.sum(:age, :group => :name)

...but check the docs, 'cause I may have messed up the syntax.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Restful routing question

2009-06-11 Thread Kendall Gifford


I know this is probably obvious, but you have verified the route
exists and looks right with "rake routes" and have restarted your
server recently enough that it has the route, yes?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Request to vote for on line SAP application.

2009-06-11 Thread Marnen Laibow-Koser

Pavan Agrawal wrote:
> Dear Guru's,
> I'ld like to request you to vote here
> http://launchpad.enterprise2conf.com/node/74 as 5 star
[...]

Why would anyone put a rating (5-star or otherwise) on a program they've 
never used?  Why would you even ask someone to?  That's dishonest.

And why would you post this on the Rails list when it doesn't seem to 
have anything to do with Rails?

Your time would be better spent soliciting honest votes from your active 
user base.  Good luck!

> 
> Best Regards,
> 
> Pavan Agrawal

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Restful routing question

2009-06-11 Thread Mario Gr

Oops.  The rails link_to path is actually: 
discard_contents_project_path(current_project, :to_project_id => 
params[:id])
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Ruby on Rails through cPanel

2009-06-11 Thread Matt Jones

The cPanel instructions are incorrect; simple gems may work using that
method, but it's not going to work in general.

See this page:
http://wiki.a2hosting.com/index.php/How_to_install_your_own_Ruby_Gems

For a better explanation of the correct way (using GEM_HOME).

--Matt Jones

On Jun 10, 7:08 pm, Rob Pa  wrote:
> Hi,
>
> I am having several problems using Ruby on Rails through cPanel. The
> main problems come when using Ruby Gems.
>
> They seem to install correctly, however errors are caused when I try to
> include them in the application.
>
> cPanel states;
>
> "Using Your Ruby Gem(s)
>
> You will need to add /home/***/ruby/gems to the include path.
> You can do this by adding the following code to your script:
>
> $:.push("/home/***/ruby/gems")"
>
> However I don't really understand what this means. Where do I put this?
>
> How would I go about including a Gem?
>
> Thanks in advance,
> Rob
> --
> 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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Module: ActionView::Helpers::DateHelper

2009-06-11 Thread Maurício Linhares

Aren't you using any kind of date_select plugin?

-
Maurício Linhares
http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr



On Thu, Jun 11, 2009 at 4:42 AM, Nike
Mike wrote:
>
> hi i am using date_select helper for displaying month day and year.I am
> trying to show month and year by the options of the helper as
> <%=date_select( "post", "written_on", :discard_day => true)%>
>
> But i am getting error as
> undefined method `styled_input' for
> #
>
> Please help me
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

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



[Rails] Re: To deploy or not to deploy on Google App Engine

2009-06-11 Thread Matt Jones

Support for Rails on App Engine is still very much "proof of concept"
right now; as other posters have noticed, the only datastore available
is BigTable, which doesn't play well with ActiveRecord at the moment.
There's also a number of subsidiary issues (like a low limit on the
number of files in the app [1000]) and very little support available.
Especially if you're at the end of a project, you're better off
deploying to an environment with more of a track record.

--Matt Jones

On Jun 10, 11:33 am, "tashfeen.ekram" 
wrote:
> I am nearing the end of a project I have been working on and trying to
> figure out if deploy on the app engine with jruby is a good option.
> They offer a tremnedous amount of bandwith, storage, etc so it is very
> tempting.
>
> i dont have any expreiences on deploying projects on jruby and was
> hoping to get people's opinion on the good and bad of it. Are there
> perfomrance issues? Could this lock me in if later if they decide to
> release support for ruby?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Sessions in Rails 2.3?

2009-06-11 Thread Maurício Linhares

Currently Rails stores sessions in the browser and this is the most
scalable solution found until now.

Unless you have a really great idea to build a better session store,
just use the cookie based one and you're done.

-
Maurício Linhares
http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr



On Thu, Jun 11, 2009 at 12:10 PM, Alex
Barlow wrote:
>
> Hi guys, new here so bonjour..
>
> Sorry if this question has been asked, but i had a good look and i'm
> just generally confused about this  at the moment!
>
> ive been learning rails for about 4 months now and im on to sessions
> and more importantly where there stored, i have "Agile web
> development" and the lydna screencasts which both talk about sessions.
>
> However the agile web development book describes these as
> ActiveRecordStore, which no longer exists?
>
> and Lynda.com is using an old unscalable file system method?
>
> Is there a nice guide, long or short someone on the web that shows how
> to do sessions currently and preferably storing them in a database
> (mysql)?
>
> Cheers, Alex
>
> >
>

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



[Rails] Re: CPU Time - ActiveRecord

2009-06-11 Thread Maurício Linhares

I guess you won't get any answers with this question.

Can't you explain your problem a little bit better?

-
Maurício Linhares
http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr



On Thu, Jun 11, 2009 at 1:13 PM, Bruno wrote:
> HI,
>
> How i get CPUTime to populate a object from a Entity class ?
>
>
> Thanks,
>
> --
> _
> Bruno Santos Dumont
> msn: bruno@gmail.com
> Fortaleza - Ce, Brasil
>
> >
>

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



[Rails] Restful routing question

2009-06-11 Thread Mario Gr

Hi,

I was wondering if you guys could help me out.

i have a link_to url like so:
discard_contents(current_project, :to_project_id => params[:id])
# =>
http://localhost:3000/projects/1163131/discard_contents?to_project_id=1121802


but I keep getting this "No action responded to 1163131" error

I am guessing it's some issue with my routing configuration, but I'm not
seeing it..

#from routes.rb

map.resources :projects, :member => { ... :move_or_discard_contents =>
:any, :move_contents => :post, :discard_contents => :post }, :collection
=> { ... } do |project|

end


/projects/discard_contents/1163131?to_project_id=1121802 works.

any ideas?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Parsing big XML files - memory issue

2009-06-11 Thread Maurício Linhares

Hi Pierre,

I had a 45~50mb file to parse using Ruby libraries but to no avail,
the DOM based libraries were slow to death and the SAX based one that
I tried (libxml-ruby) had some serious memory leaks. Now there's this
SaxMachine from paul dix that looks usable -
http://www.pauldix.net/2009/01/sax-machine-sax-parsing-made-easy.html

As to my problem, I wrote a StAX based parser using Java to get it to
run in reasonable time :(

-
Maurício Linhares
http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr

On Thu, Jun 11, 2009 at 5:41 AM, PierreW wrote:
>
> Hello,
>
> I need to parse two big XML files in a row (30+MB each). I have tried
> both REXML and Hpricot. They do work. Thing is, with both libraries,
> the parsing of each file takes a huge amount of memory: more than
> 700MB each!
>
> So I was wondering:
> - is it normal that parsing a 30MB file takes 700MB of memory? Could
> it be that something is wrong with the file? Is there an alternative
> way to deal with such big files?
> - is there a way to force the release of the memory when I don't need
> the file anymore? At the moment it is not released instantly after the
> first file, so I end up with 1.5GB memory use.
>
> I have reduced the code to the minimum to isolate the memory issue:
>
> xml = File.read("myfile.xml")
> doc = REXML::Document.new(xml) or doc = Hpricot.XML(xml)
> doc = nil
>
> and repeat with the second file.
>
> Also, I tried libxml in case. I get an error message that I can't
> explain:
> LibXML::XML::Error (Fatal error: Input is not proper UTF-8, indicate
> encoding !  yet the file is UTF-8 as far as I can tell.
>
> Thanks a lot for your help.
> Pierre
>

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



[Rails] Re: Using view helpers and route helpers in a model

2009-06-11 Thread Matt Jones

There's probably a workaround, but I'd agree that this is the wrong
way to do things. Generally, if you're producing HTML in models
something has gone seriously awry..

--Matt Jones

On Jun 11, 8:17 am, Rob Lacey  wrote:
> Hi there,
>
> I am trying to get something working and its driving me crazy. I have
> been looking around for solutions to getting view helpers working in
> models and for the most part I find this solution.
>
> Add the following in the model you want to use them in
>
>   include ActionView::Helpers::UrlHelper
>   include ActionController::UrlWriter
>
> However, when I try something like
>
> link_to(polymorphic_path(@node)) I get an error.
>
> "can't convert String into Hash"
>
> This is because 'link_to' uses 'url_for' which is a method that both 
> UrlHelper and UrlWriter both have which actually behave differently.
>
> so my polymorphic_path(@node) => "/nodes/1" is a string and 
> ActionController's url_for is expecting a hash.
>
> Has anyone seem this and found a nice clean solution, or is this just the 
> wrong way to go about things
>
> Cheers
>
> RobLhttp://www.robl.me
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Sessions in Rails 2.3?

2009-06-11 Thread Alex Barlow

Hi guys, new here so bonjour..

Sorry if this question has been asked, but i had a good look and i'm
just generally confused about this  at the moment!

ive been learning rails for about 4 months now and im on to sessions
and more importantly where there stored, i have "Agile web
development" and the lydna screencasts which both talk about sessions.

However the agile web development book describes these as
ActiveRecordStore, which no longer exists?

and Lynda.com is using an old unscalable file system method?

Is there a nice guide, long or short someone on the web that shows how
to do sessions currently and preferably storing them in a database
(mysql)?

Cheers, Alex

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



[Rails] CPU Time - ActiveRecord

2009-06-11 Thread Bruno
HI,

How i get CPUTime to populate a object from a Entity class ?


Thanks,

-- 
_
Bruno Santos Dumont
msn: bruno@gmail.com
Fortaleza - Ce, Brasil

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



[Rails] Re: Storing Ruby expressions to execute later

2009-06-11 Thread Xavier Noria

On Thu, Jun 11, 2009 at 6:12 PM, tashfeen.ekram wrote:

> Is there a way to store rb expression so that can be interpreted
> later. For example, i store as a string for example in my db "3+2" and
> then at a later time i would like to execute it at future time. I am
> allowing my users to generate code to analyze data and would like to
> be able to allow the users to generate whatever expressions they see
> fit. the actual expressino will be more complex but that is just an
> example.

Can you trust your users? Can you be confident they won't put
"User.delete_all" as Ruby code?

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



[Rails] Re: protect_from_forgery doesnt protect from forgery

2009-06-11 Thread Xavier Noria

On Thu, Jun 11, 2009 at 4:20 PM, C, D. wrote:

>>> the controller I have kept it simple and did a
>>> @user.update_attributes(params[:user]), expecting that the
>>> authenticity_token would never allow any params to be posted that I
>>> didnt allow through my form.
>>
>>  The forgery protect_from_forgery protects against is cross site
>> request forgery, ie. completely unrelated to the problem you're
>> tackling. You may be interested in attr_protected/attr_accessible.
>>
>> Fred
>
> Alright that makes sense. I might have misunderstood the PFF function.
>
> But I still feel this is a grossly underestimated security hole. It
> doesn't seem very ruby-esque to shield the 'forbidden' attributes with
> attr_accessors. Since on one form you might be allowed to change it, yet
> on a different one you wont have that field supplied.
>
> You obviously dont want to hard code your data entry restrictions on
> controller level. That violates the DRY principle. When I change the
> form to allow someone to edit an extra field, I also have to 'open up'
> this field in the controller.

The current solution is a trade-off: it is a simple solution that
covers most use cases. Often the account_id of your User model is
protected, period. That's what the current design supports.

There was a recent discussion in the core mailing list about possible
ways to make this a little more flexible:

   
http://groups.google.co.uk/group/rubyonrails-core/browse_thread/thread/3b6818496d0d07f1/0d20bb9236fe59af#0d20bb9236fe59af

but no conclusion except for some workarounds to the current solution
when you need 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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Storing Ruby expressions to execute later

2009-06-11 Thread tashfeen.ekram

Is there a way to store rb expression so that can be interpreted
later. For example, i store as a string for example in my db "3+2" and
then at a later time i would like to execute it at future time. I am
allowing my users to generate code to analyze data and would like to
be able to allow the users to generate whatever expressions they see
fit. the actual expressino will be more complex but that is just an
example.

thanks,
tashfeen

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



[Rails] Re: before_create return value breaking object.save: rails bug?

2009-06-11 Thread Max Williams

Frederick Cheung wrote:
> On Jun 11, 4:45�pm, Max Williams 
> wrote:
>> I know that usually when people say 'i think i found a bug in
>> rails/ruby' they've done something dumb. �I'm wondering if this is the
>> case here, but this does seem like a genuine rails bug to me.
>>
>> In my user model i have a few different before_create callbacks. �In one
>> of them, if it happens to return false (just because the last statement
>> in it evaluated to false), then the saving gets blocked - i can see the
>> db transaction rolling back. �However, this doesn't affect the results
>> of calling .valid? on the object, so i get this situation:
>>
> It's a feature. See 
> http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html
> (under Canceling callbacks)
> 
> Fred

Hi Fred

Yeah, i just stumbled across that bit of documentation as it happens. 
It seems a little bit hidden, to me.
http://www.railsbrain.com/api/rails-2.2.2/doc/index.html?a=C0640&name=Callbacks

For such an important bit of knowledge, it seems buried halfway down the 
page.

So, i guess i was being a bit dumb, but maybe a little forgiveably so? 
There must be a lot of people making this mistake.  There's probably a 
lot of people with callbacks in their application already who don't even 
realise that they're returning false just because of the last statement 
in there and breaking.

I still think it's wrong that this situation can occur:

@user.valid?
 => true
@user.save
 => false
@user.errors.full_messages
 => []

Where's the feedback?  How am i supposed to know why it didn't save? 
argghh.

ah well. you live and learn.
grumble...

thanks, anyway!
max
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: How to display categorized pages in the most effective way?

2009-06-11 Thread Emmek on Rails

OK, I was given the complete solution. I have the following pieces of 
code:

controller:

@thematized_pages = @page.children.group_by(&:theme)

view:

<% @thematized_pages.each do |theme, pages| -%>
  <%= theme ? theme.name : 'Others' %>
  
  <% pages.each do |page| %>
<%= link_to h(page.title), 
h(page.parent.link_name+'/'+page.link_name) %>
  <% end -%>
  
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: before_create return value breaking object.save: rails bug?

2009-06-11 Thread Frederick Cheung



On Jun 11, 4:45 pm, Max Williams 
wrote:
> I know that usually when people say 'i think i found a bug in
> rails/ruby' they've done something dumb.  I'm wondering if this is the
> case here, but this does seem like a genuine rails bug to me.
>
> In my user model i have a few different before_create callbacks.  In one
> of them, if it happens to return false (just because the last statement
> in it evaluated to false), then the saving gets blocked - i can see the
> db transaction rolling back.  However, this doesn't affect the results
> of calling .valid? on the object, so i get this situation:
>
It's a feature. See 
http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html
(under Canceling callbacks)

Fred
> new_user.valid?
>  => true
> new_user.save
>  => false
> new_user.errors.full_messages
>  => []
>
> This has caused me a considerable amount of beard-tugging to track this
> down.
>
> Now, i was under the impression that before_create doesn't care what's
> returned by the method it calls, and for my other before_save callbacks
> it doesn't seem to make any difference - just this one.  It's definitely
> the return value because if i put 'true' as the last line of the
> callback method then everything is fine.  I change it to 'false' and
> everything's not-fine again.
>
> I'm in rails 2.2.2.
>
> Can anyone shed any light on this?
>
> thanks
> max
> --
> 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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] before_create return value breaking object.save: rails bug?

2009-06-11 Thread Max Williams

I know that usually when people say 'i think i found a bug in
rails/ruby' they've done something dumb.  I'm wondering if this is the
case here, but this does seem like a genuine rails bug to me.

In my user model i have a few different before_create callbacks.  In one
of them, if it happens to return false (just because the last statement
in it evaluated to false), then the saving gets blocked - i can see the
db transaction rolling back.  However, this doesn't affect the results
of calling .valid? on the object, so i get this situation:

new_user.valid?
 => true
new_user.save
 => false
new_user.errors.full_messages
 => []

This has caused me a considerable amount of beard-tugging to track this
down.

Now, i was under the impression that before_create doesn't care what's
returned by the method it calls, and for my other before_save callbacks
it doesn't seem to make any difference - just this one.  It's definitely
the return value because if i put 'true' as the last line of the
callback method then everything is fine.  I change it to 'false' and
everything's not-fine again.

I'm in rails 2.2.2.

Can anyone shed any light on this?

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

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



[Rails] Re: Need help with assert_select semantics

2009-06-11 Thread James Byrne

James Byrne wrote:

> 
> So, what is it that I am misapprehending with assert_select?

That one may not have a '.' form part of a class value.

  '.base_rate_is_0.8444' s/b
  '.base_rate_is_0_8444'
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Need help with assert_select semantics

2009-06-11 Thread James Byrne

I have this type of table row generated in a view:

...
  

CAD 
USD 
2009-04-05 
TEST 

  1.184273

features test 
  
...

There are many instances of dorex_rate_line and I wish to select only
those that also contain a class "base_rate_is_0.8444" and I wish to
valiously test that there are: at least, exactly, or at most, N
occurrences.

For the exact match I have tried this:

  count = 1
  assert_select(  '.base_rate_is_0.8444', { :count => count.to_i } )

But that gives this error:

  Expected at least 1 element matching "base_rate_is_0.8444", found 0.
   is not true. (Test::Unit::AssertionFailedError)

On the other hand, using exactly the same data I do this and it works as
I anticipate:

count = 1
code = 'USD'
assert_select(  '.quote_currency',
{ :maximum => count.to_i,
  :text => code })

So, what is it that I am misapprehending with assert_select?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: protect_from_forgery doesnt protect from forgery

2009-06-11 Thread C, D.

Frederick Cheung wrote:
>> the controller I have kept it simple and did a
>> @user.update_attributes(params[:user]), expecting that the
>> authenticity_token would never allow any params to be posted that I
>> didnt allow through my form.
> 
>  The forgery protect_from_forgery protects against is cross site
> request forgery, ie. completely unrelated to the problem you're
> tackling. You may be interested in attr_protected/attr_accessible.
> 
> Fred

Alright that makes sense. I might have misunderstood the PFF function.

But I still feel this is a grossly underestimated security hole. It 
doesn't seem very ruby-esque to shield the 'forbidden' attributes with 
attr_accessors. Since on one form you might be allowed to change it, yet 
on a different one you wont have that field supplied.

You obviously dont want to hard code your data entry restrictions on 
controller level. That violates the DRY principle. When I change the 
form to allow someone to edit an extra field, I also have to 'open up' 
this field in the controller.

The form fields I specify in the form are the only fields the user is 
allowed to change on that particular entry point. How can I enforce that 
no extra fields are introduced?

I am thinking about an idea very similar to the authenticity token from 
protect_from_forgery. Create a hash based on all the fields in a form 
and some serverside secret. Whenever the post params come in I know 
which fields are posted so I can recreate this hash and compare.

Has this been done before? Or would I have to build this into a plugin 
from scratch?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: scaffold and links created

2009-06-11 Thread Ar Chron

Rails is ignoring your new method in the controller because you haven't 
told Rails about it in your routes.rb file.

If you add a method in the controller that is the target of an HTTP 
request, you'll need to add that method to the routes.rb file.

http://api.rubyonrails.org/classes/ActionController/Resources.html

Where you probably have:

map.resources :posts

you need to tell Rails about any added methods.

Added methods for a collection of posts goes into a :collection => 
{:action => :verb} hash.
Added methods for a single post goes into a :member => {:action => 
:verb} hash.

:action is your controller method name,
:verb is the HTTP verb, :get, :post, :put, :delete (or :any)

If you've implemented a 'remove_all' method for the collection of posts, 
as well as a generate_pdf method for a single post, your routes.rb might 
look like:

map.resources :posts, :collection => {:remove_all => :delete}, :member 
=> {:generate_pdf => :get}
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: HAML and SASS - worth the conversion with rails?

2009-06-11 Thread Ar Chron

I'd pick one set of views and convert those first.  Choose a model that 
has some of the moderately complex views, with partials involved. 
You'll learn HAML, all your changes are restricted to a single set of 
views, and the rest of your app goes merrily on its way while you 
sharpen your skills.

I love HAML for the brevity in the code, and the readability.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Rails Hosting Questions

2009-06-11 Thread Älphä Blüë

In case anyone reads this thread - Slicehost measured up to all the hype 
given it.  It is fantastic.  I got my slice yesterday evening and by the 
next morning my complete site is up and running from start to finish. 
It was not as difficult as I thought it would be.

Also, the admins have a chat room and I sat in the chat room and anytime 
I encountered an issue or had a question they answered me immediately! 
They are there 24/7!

Everything has gone as smooth as a baby's bottom.  I'm very happy and 
excited.

I wanted to say thanks again for letting me know about the site.

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

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



[Rails] Re: Parsing big XML files - memory issue

2009-06-11 Thread Jeffrey L. Taylor

Quoting PierreW :
> 
> Hello,
> 
> I need to parse two big XML files in a row (30+MB each). I have tried
> both REXML and Hpricot. They do work. Thing is, with both libraries,
> the parsing of each file takes a huge amount of memory: more than
> 700MB each!
> 
> So I was wondering:
> - is it normal that parsing a 30MB file takes 700MB of memory? Could
> it be that something is wrong with the file? Is there an alternative
> way to deal with such big files?
> - is there a way to force the release of the memory when I don't need
> the file anymore? At the moment it is not released instantly after the
> first file, so I end up with 1.5GB memory use.
> 

Generally XML libraries keep the whole content, including whitespace, in an
easily searchable tree structured data structure, often plus the original
text, plus overhead.

> I have reduced the code to the minimum to isolate the memory issue:
> 
> xml = File.read("myfile.xml")
> doc = REXML::Document.new(xml) or doc = Hpricot.XML(xml)
> doc = nil
> 
> and repeat with the second file.
> 
> Also, I tried libxml in case. I get an error message that I can't
> explain:
> LibXML::XML::Error (Fatal error: Input is not proper UTF-8, indicate
> encoding !  yet the file is UTF-8 as far as I can tell.
> 

LibXML is very picky about UTF-8 and I have not been able to figure how to get
it to recover and continue parsing.  Since Hpricot and Nokogiri are less
picky and they use LibXML, I presume it is possible.

Whenever I have dug into the source file in question, there has been a
non-UTF8 character.  Look at the reader.line_number and reader.column_number
values for where.

As another person has suggested, the SAX API does not keep the whole file or
DOM in memory and uses much less memory.  Also look at XML::Reader interface,
it is very fast and not at all memory hungry.  Your code will probably not be
as pretty as with the DOM APIs, but sometimes it is worth the trade offs.
Switching from FeedTools to read RSS feeds to XML::Reader to grab just what my
app needs resulted in a speed up of better than 10x, maybe 100x.  This is
applicable if your code is handling multiple XML schemas (there are at least 6
different RSS schema with varying interpretations, for some fields the whole
DOM is searched 10 times; once thru with custom code is ugly, but worth it in
my application).

HTH,
  Jeffrey

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



[Rails] Re: cannot open database under Passenger

2009-06-11 Thread Rick DeNatale

On Thu, Jun 11, 2009 at 12:11 AM, Mk 27 wrote:
>
> Rick Denatale wrote:
>
>> By default though the passenger process for a rails app tries to run
>> as the user which owns conf/environment.rb unless configured otherwise
>> it runs as the user nobody unless configured otherwise.
>>
>> http://www.modrails.com/documentation/Users%20guide.html#user_switching
>> http://www.modrails.com/documentation/Users%20guide.html#PassengerUserSwitching
>
> Thanks Rick.  I added this to httpd.conf
>
> PassengerDefaultUser root
>
> and presto.

I think it would be better to use a user with less privilege than root.

-- 
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

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



[Rails] Re: DRY (don't repeat yourself) way / Hook to Activerecord o

2009-06-11 Thread hoenth


> God please tell me he did not suggest to use threads in order to add an
> argument.
> --
> Posted viahttp://www.ruby-forum.com/.

Here is a brief discussion on Thread.current used in class variables.

http://coderrr.wordpress.com/2008/04/10/lets-stop-polluting-the-threadcurrent-hash/

As there is clearly debate about the robustness of using this method,
I offer it only as a suggestion. It has worked for me.

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



[Rails] Troubles with polymorphics associations

2009-06-11 Thread Sephi-Chan

Hello,

Since some days, I try to create a dynamic user profiling system. In
this system, users can use many fields defined in a list.

In these fields, there are ones which admit a scalar value (like
firstname or birthday) and others which admit a collection (like
skills or visited countries) of value.

I have some troubles with that… How can i manage these polymorphic
fields ? Can you help me the define my models and their relations ?

Thanks for reading,


Sephi-Chan

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



[Rails] Multiple dynamically generated form fields

2009-06-11 Thread Mark Studebaker
Just wondering what the best "Rails way" to do this would be..

I have a form that uses an auto complete text box and a  that holds n 
number of selections from the text box.  The  is made up of multiple  
each with the id set to the modelname_id.  When the user submits the form, I 
parse  through the  elements and populate two hidden form fields (one for 
each type of model in the ) with a , separated string then on the server I 
split the fields and create my database records.  This all works fine but it 
doesn't seem "right"

How should I be doing this?  I thought about creating hidden input fields (one 
for each ) or create input fields in the  and disabling and styling 
them to look the way I need...?  Seems like rails would be able to handle the 
array of fields better then the , delimited fields I'm currently using...??

Not sure of the best approach.

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



[Rails] Using view helpers and route helpers in a model

2009-06-11 Thread Rob Lacey

Hi there,

I am trying to get something working and its driving me crazy. I have 
been looking around for solutions to getting view helpers working in 
models and for the most part I find this solution.

Add the following in the model you want to use them in

  include ActionView::Helpers::UrlHelper
  include ActionController::UrlWriter

However, when I try something like

link_to(polymorphic_path(@node)) I get an error.

"can't convert String into Hash"

This is because 'link_to' uses 'url_for' which is a method that both UrlHelper 
and UrlWriter both have which actually behave differently.

so my polymorphic_path(@node) => "/nodes/1" is a string and ActionController's 
url_for is expecting a hash.

Has anyone seem this and found a nice clean solution, or is this just the wrong 
way to go about things

Cheers

RobL
http://www.robl.me




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



[Rails] Re: Application hanging in production! New Relic Phy Mem Utilization Haywire! Help!

2009-06-11 Thread Ram

Hey blasterpal,
already on it!
more information in case u can help. I run a cron on my server which
basically accesses a particular URL in my Rails app which performs
some tasks. it seems to take loads of time.. and when i drill down in
New Relic, the following line is thrown up..

   Dependencies.new_constants_in(Object) { super }

this is a line from active_support

File: /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/
active_support/dependencies.rb

i saw a couple of error throws caused due to dependency loading from
active_support in my production log earlier yesterday during initial
analysis.

Any more ideas?
- Hide quoted text -

On Thu, Jun 11, 2009 at 5:26 PM, blasterpal  wrote:
>
> Ram,
>
> I've gotten burned recently with production issues not related to
> yours. But I only want to add the following. Rollback your changes and
> see if the problem disappears for a few days. If so, then you know
> where to start looking: at your new code and how it interacts with the
> database, Rails ,etc.
>
> H

On Jun 11, 4:44 pm, Ram  wrote:
> Hi all,
>
> My app was doing fairly well in production past couple a months. But
> past 2 days, its gone off its rocker! Not able to figure out what the
> problem is. The symptoms are as follows..
>
> - It first went down when I deployed and ran a migration yesterday. A
> simple column addition to a table
> - The production log showed the SignalException::SIGTERM error ( dont
> know anything about it )
> - a server reboot seems to solve the problem temporarily
> - New Relic RPM shows wayward physical mem utilization.
> - im on Slicehost and the 'free' command shows way too much SWAP
> memory usage (which is basically not good)
>
> Does it sound like im having a memory leak? anywhere i could look?
> anything i can do??
> Oh those who have fought the battle and come out victorious.. bestow
> upon me ur knowledge! :D
> Seriously.. any pointers?
>
> 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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Application hanging in production! New Relic Phy Mem Utilization Haywire! Help!

2009-06-11 Thread Ram

Hi all,

My app was doing fairly well in production past couple a months. But
past 2 days, its gone off its rocker! Not able to figure out what the
problem is. The symptoms are as follows..

- It first went down when I deployed and ran a migration yesterday. A
simple column addition to a table
- The production log showed the SignalException::SIGTERM error ( dont
know anything about it )
- a server reboot seems to solve the problem temporarily
- New Relic RPM shows wayward physical mem utilization.
- im on Slicehost and the 'free' command shows way too much SWAP
memory usage (which is basically not good)

Does it sound like im having a memory leak? anywhere i could look?
anything i can do??
Oh those who have fought the battle and come out victorious.. bestow
upon me ur knowledge! :D
Seriously.. any pointers?

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



[Rails] Re: Pagination: Last Page

2009-06-11 Thread PP Junty

you should use blank? instead of nil? because even the original
will_paginate will throw an error if you pass an empty string.
and you should not rely on what you receive in the param :page as
a user could manually alter the url to some strange value. what
i do is to have a parse method that ensure that will_paginate is
getting a valid page number, that is why i didn't bother throwing
a more informative error message, i'll see if it can be improved.

> Thanks for the code. Didn't catch the attachment at first sight. I 
> tested the plugin and it works quite fine. However, I have a small 
> problem while selecting a specific page. :page => :last always redirects 
> to the last page, even if a parameter is given. I tried to check the 
> parameter before, but this throws an error as well:
> 
> if (params[:page].nil?)
>   @replies = @bullet.replies.paginate :page => :last, :order => 
> 'created_at ASC', :per_page => 10
> else
>   @replies = @bullet.replies.paginate :page => params[:page], :order => 
> 'created_at ASC', :per_page => 10
> end
> 
> Throws:
> comparison of String with 2 failed
> 
> /Users/patrick/Sites/insight/vendor/plugins/will_paginate_last/lib/will_paginate_last/finder.rb:39:in
>  
> `>'
> /Users/patrick/Sites/insight/vendor/plugins/will_paginate_last/lib/will_paginate_last/finder.rb:39:in
>  
> `paginate'

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

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



[Rails] Re: Rest with ruby objects?

2009-06-11 Thread johnmcau...@gmail.com


I haven't but I will.

Thanks,
J

On Jun 11,,
 10:18 am, Webdevotion  wrote:
> Have you had a look athttp://restfulx.github.com?
>
> On Wed, Jun 10, 2009 at 6:24 PM, johnmcau...@gmail.com <
>
> johnmcau...@gmail.com> wrote:
>
> > Hello Everyone,
>
> > Does anybody know how to use rest to deliver non-active record models
> > in rails 2.3.2.  I am using flex as a front end for a huge data set
> > and I end to crunch the numbers on the back end before passing arrays
> > of counts through to the visualisation.
>
> > Any help greatly appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: DRY (don't repeat yourself) way / Hook to Activerecord object (to store IP address on every object created)

2009-06-11 Thread Mukund

Replace the class variable with a method call instead?

On Jun 10, 7:48 pm, Jodi Showers  wrote:
> Makund - it is quite likely that your solution will break when  
> multithreading arrives (as will will loads of other stuff)
>

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



[Rails] Re: To deploy or not to deploy on Google App Engine

2009-06-11 Thread Mukund

It is not as simple as running your application in JRuby and deploying
on the App engine.Datastore is different on Google App Engine and
you will need to do significant work to accommodate Google's big table
instead of active record.   Moreover, those APIs are Java only which
will require you to write some component in Java to accommodate your
data storage needs.

On Jun 10, 8:33 pm, "tashfeen.ekram"  wrote:
> I am nearing the end of a project I have been working on and trying to
> figure out if deploy on the app engine with jruby is a good option.
> They offer a tremnedous amount of bandwith, storage, etc so it is very
> tempting.
>
> i dont have any expreiences on deploying projects on jruby and was
> hoping to get people's opinion on the good and bad of it. Are there
> perfomrance issues? Could this lock me in if later if they decide to
> release support for ruby?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Mongrel crashes while running 'exec' through ruby

2009-06-11 Thread Tahir Rauf

Got the solution, exec starts a new process so don't use it..

just use the shell command in ruby like this

`sh /home/abc.sh`


in the controller..


It runs fine

Thanks Every body
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Request to vote for on line SAP application.

2009-06-11 Thread Pavan Agrawal @ Rails

Dear Guru's,
I'ld like to request you to vote here
http://launchpad.enterprise2conf.com/node/74 as 5 star (please click
on 5 star to vote), this will give oxygen to our project.

Waiting for your valuable vote.


Best Regards,

Pavan Agrawal

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



[Rails] Re: Parsing big XML files - memory issue

2009-06-11 Thread Frederick Cheung



On Jun 11, 9:41 am, PierreW  wrote:
> Hello,
>
> I need to parse two big XML files in a row (30+MB each). I have tried
> both REXML and Hpricot. They do work. Thing is, with both libraries,
> the parsing of each file takes a huge amount of memory: more than
> 700MB each!
>
> So I was wondering:
> - is it normal that parsing a 30MB file takes 700MB of memory? Could
> it be that something is wrong with the file? Is there an alternative
> way to deal with such big files?

DOM parsers can use up a lot of memory with large files (10x filesize
or more). SAX parsers don't (because they don't keep the whole thing
in memory - they just fire events as they traverse the dom). REXML
does have a sax style parser, and libxml will have one too.

Fred
> - is there a way to force the release of the memory when I don't need
> the file anymore? At the moment it is not released instantly after the
> first file, so I end up with 1.5GB memory use.
>
> I have reduced the code to the minimum to isolate the memory issue:
>
> xml = File.read("myfile.xml")
> doc = REXML::Document.new(xml) or doc = Hpricot.XML(xml)
> doc = nil
>
> and repeat with the second file.
>
> Also, I tried libxml in case. I get an error message that I can't
> explain:
> LibXML::XML::Error (Fatal error: Input is not proper UTF-8, indicate
> encoding !  yet the file is UTF-8 as far as I can tell.
>
> Thanks a lot for your help.
> Pierre
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Rest with ruby objects?

2009-06-11 Thread Webdevotion
Have you had a look at http://restfulx.github.com?



On Wed, Jun 10, 2009 at 6:24 PM, johnmcau...@gmail.com <
johnmcau...@gmail.com> wrote:

>
> Hello Everyone,
>
> Does anybody know how to use rest to deliver non-active record models
> in rails 2.3.2.  I am using flex as a front end for a huge data set
> and I end to crunch the numbers on the back end before passing arrays
> of counts through to the visualisation.
>
> Any help greatly appreciated.
> >
>

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



  1   2   >