[Rails] .htaccess

2008-11-12 Thread Abhishek shukla

Hello friends.

I have hosted my application on bluehost and from cpanel i created a
rails application which is generated inside my public_html folder.

~/public_html/myapp

then i followed the following steps

ln -s ~/public_html/myapp/public myapplive

any edited my .htaccess file like
RewriteBase /myapplive
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

So now everything is working fine but the All my links are displaying
http://www.domainname.com/myapplive/controller/action

So i Just want my url should be
http://www.domainname.com/controller/action

any suggestion?

thanks
Abhi

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



[Rails] Re: Where to put custmized files in Rails app?

2008-11-12 Thread Mukund

Why do you need to maintain a directory of files?There are preset
directories already for anything you do with the Rails MVC framework
and the lib directory gives you a spot to put additional modules.
Static files that get pushed to the users belong in the public/
directory, etc.

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



[Rails] Re: Link to mysql.sock deleted at reboot

2008-11-12 Thread Mukund

Why don't you use the socket option in database.yml to point to
opt/...  ?   You can use this setting for development and another for
production.  Alternatively create database.mymachine.yml and
database.production.yml and link the right file to database.yml



On Nov 12, 12:16 pm, Pål Bergström [EMAIL PROTECTED]
wrote:
 I'm on Mac OS 10.5. How do I get a link from /tmp/mysql.sock  to
 /opt/.../mysql.sock to stay after reboot?

 Is there a better way of doing this, like adding an alias in .profile if
 possible, or is it assumed that you never reboot your machine? :-)
 --
 Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Rails site for mobile devices too

2008-11-12 Thread Frederick Cheung



On Nov 12, 2:59 am, Sazima [EMAIL PROTECTED] wrote:
 Hi Fred,

 Thanks for the help and patience! I'm almost getting what I need, but
 2 things are still missing (XHTML views and cookies/sessions). Can you
 provide a short example for them?

 1. rails does xhtml anyway

You don't need to do anything(except I suppose putting the correct
doctype and so on in your layout), you'll get xhtml anyway

 2. Same as normal, but like I said mobile browsers are likely to be
 more
 stringent when it comes to stopping you going overboard = how do you
 set sessions and retrieve values? It's really not working for me...

I never had to do anything different than on the desktop.

Fred

 Cheers, Sazima

 On Nov 11, 3:29 pm, Frederick Cheung [EMAIL PROTECTED]
 wrote:

  On 11 Nov 2008, at 17:05, Sazima wrote:

   So, cookies work after all? Any special way of setting it and/or
   handling?

  Same as normal, but like I said mobile browsers are likely to be more  
  stringent when it comes to stopping you going overboard (or just  
  deleting old cookies because they only allocate a small amount of  
  space to cookies).

  Fred

   Cheers, Sazima

   On Nov 11, 2:41 pm, Frederick Cheung [EMAIL PROTECTED]
   wrote:
   On 11 Nov 2008, at 16:32, Sazima wrote:

   Hi Fred,

   The audience is the average Internet user. Any idea on what mobile
   browser capabilities to expect? Do you think WML is mandatory or can
   we stick to xHTML?

   No idea, not really my area of expertise

   How did you generate xHTML views? Did you use any specific editor /
   IDE?

   rails does xhtml anyway.

   Finally, how do you differentiate between your users?

   We have a slightly peculiar setup but at the end of the day we  
   decided
   cookies were enough.

   Cheers, Sazima

   On Nov 11, 12:09 pm, Frederick Cheung [EMAIL PROTECTED]
   wrote:
   On 11 Nov 2008, at 13:58, Ricardo Sazima wrote:

   Guys,

   Need help on how to serve pages for mobile devices. Can someone
   point out a couple of references to start? I've been reading some
   materials and already have a couple of questions:

   1. Is WAP (WML) still needed or can we go directly to XHTML-MP? I
   mean do the majority of mobile browsers already understand XHTML-
   MP?
   What is it's acceptance and spread?

   2. Any generators for XHTML-MP views? Coding by hand is quite
   arduous...

   The mobile stuff I've done has been plain old xhtml mobile profile
   stuff. I'm sure there are old-skool wap phones still out there
   though.
   To an extent it depends on your target market, eg if you're primary
   target is business people then making sure it works well on a
   blackberry is probably more important than worrying about wap

   3. How to handle login and sessions? I mean, does the mobile  
   device
   sends it's telephone number? Or any other unique identifier? Is it
   capable of accepting  storing cookies?

   Mobile devices tend to be a lot stricter as to how many cookies  
   they
   will store and things like that. Phones do not send a unique id or
   their phone number, but companies likehttp://bango.com/havedeals
   with the mobile network operators that allow them to identify  
   people
   (last time I looked it thought everyone using opera mini was in
   norway
   (because opera mini proxies traffic through servers in norway) and
   had
   trouble with iphones.

   Fred

   Thanks in advance for the help!

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



[Rails] Re: Rails requires RubyGems = 1.1.1 : problem

2008-11-12 Thread Thomas Balthazar
Hello,
Did you try to run 'gem update --system'?
Which OS are you running?

Best,
Thomas.

On Tue, Nov 11, 2008 at 1:41 AM, 元明 進藤 [EMAIL PROTECTED]wrote:


 Excuse me. I'm caught in a similar problem.
 thank you for the hints so far.

 But symptom at my hands has a great difference to Balthazar-san's one;
 gem -v returns 1.1.0,
 and it sticks whatever I've done(have downloaded rubygems-1.3.1 and let
 steup.rb run).

  I froze it to 2.1.2 and script/server start now works.

 So I don't get success in freezing: the same error message comes up!
 when try freezing.

 Won't you please give some further hints?
 I guess gem -v should be to return 1.3.1 somehow...

 

 SHINDO [EMAIL PROTECTED], Japan

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

 


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



[Rails] Re: how to retrive multiple vaules from a view for a text_field!

2008-11-12 Thread Frederick Cheung



On Nov 12, 5:18 am, Raji Mani [EMAIL PROTECTED]
wrote:
 Frederick Cheung wrote:
  On Nov 11, 9:46 am, Raji Mani [EMAIL PROTECTED]
  wrote:
  Hi,

  I have view page which takes all the information like contact's emails ,
  phones no's etc and saves different tables. I want to save more than one
  email id's for a particular contact.

  view page is something like this..

  There's two separate problems here:
  - how you manage the ui, ie adding extra textfields to the page
  - how you convince rails to treat these textfields as an array.

  The key to the second part is how you name the parameters. In
  particular parameters ending with a [] are treated as arrays.

  Fred

 Yes . I was able to submit more than one text field values.. but now my
 issue is how do i differentiate radio buttons with the same name.. both
 the radio buttons are getting selected :(.. here is the code

the builders yielded by form_for and fields_for have the same name, so
they'll be overwriting each other (which isn't what I thing you want).
Also shouldn't the second parameter to radio_button be index and not
'index' ?

Fred
  % form_for :@contact do |f| %
              % @contact.emails.each_with_index do |email, index| %
              % fields_for email[#{index}], email do |f| %tr td
              Email   nbsp nbsp;
              %= f.select :email_type, %w(Business Personal),
 :include_blank = false %
              %= f.text_field :email %
        %= f.radio_button :isprimary ,'index' %Primary
              /td/tr
               % end %
           % end %
 % end %
 --
 Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Link to mysql.sock deleted at reboot

2008-11-12 Thread Pål Bergström

Mukund wrote:
 Why don't you use the socket option in database.yml to point to
 opt/...  ?   You can use this setting for development and another for
 production.  Alternatively create database.mymachine.yml and
 database.production.yml and link the right file to database.yml
 
 
 
 On Nov 12, 12:16�pm, P�l Bergstr�m [EMAIL PROTECTED]

I could do that, but it's convenient to use /tmp/mysql.sock as other 
programs look there first.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Run 1.2.6 rails application on 2.0.2 rails

2008-11-12 Thread Brijesh Shah

Hi All,

Currently I have two types of project.
one is made in 1.2.6 and another in 2.0.2
I upgraded gems and all that. Rails 2.0.2 application are running
perfectly but 1.2.6 is not.

 from /usr/lib/ruby/gems/1.8/gems/soap4r-1.5.8/lib/soap/ns.rb:18
from
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
from
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in
`require'
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in
`new_constants_in'
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in
`require'
from
/usr/lib/ruby/gems/1.8/gems/soap4r-1.5.8/lib/soap/generator.rb:10
from
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
 ... 73 levels...
from
/usr/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/commands/server.rb:39
from
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
from
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from script/server:3


This kind of error is there...
So can anyone tell me how can I run both kind of application on same
system.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: missing sourcefile (no such file to load)-- squlite3 error

2008-11-12 Thread Jarl Friis

Ryan Bigg wrote:
 Rails 2.0.2 uses sqlite3 by default. Either you:
 
 1. Install sqlite and install the sqlite-ruby gem.

You probably mean sqlite3-ruby. At least that worked for 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: ASP.NET to Rails with MySQL

2008-11-12 Thread AndyV

Yes, you can mix hand-rolled sql queries (find_by_sql) with rails
generated queries (find) as much as you like.

On Nov 12, 6:49 am, Shilo Ayalon [EMAIL PROTECTED]
wrote:
 Hi -

 I'm thinking about porting an ASP.NET app to rails. This will require
 complete re-write of the site's code, and I'm fine with it. With ASP.NET
 I use a lot of MySQL views constructed from tables, and I wondered how I
 could do this with rails.

 I just started reading about RoR since I heard a lot of good things
 about it and wanted a piece of the action. I'm really resisting the urge
 to go with Django, even though I have a solid background with python
 (any thoughts?). Thing is, I'm really used to formulating my own DB
 queries, and rails handles all of those behind the scenes -- not
 necessarily a bad thing, just need to get used to it. My question is, is
 there a way to build rails apps with explicit queries, or mix
 ActiveRecord action with those? I'd love to some feedback. Thanks!
 --
 Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: is it possible in rails ?

2008-11-12 Thread Thani Ararsu

Thanks for reply

 Multiple file uploads are possible with swf_upload:
 http://swfupload.org/

so we can select multiple files from file browsers by use of SWFupload.

is it right ?

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

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



[Rails] Re: How to get the list of installed plugins?

2008-11-12 Thread jemminger

ruby script/plugin list

On Nov 12, 5:22 am, Jej [EMAIL PROTECTED] wrote:
 Hi all,

 Is there a simple way to get a list of installed plugins in an app? I
 need name and version of each running plugin. I saw some methods in
 the API, but related to the loading of plugins.

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



[Rails] Re: How to revise array

2008-11-12 Thread Thani Ararsu


 After array initalization I want to revise several elements and delete
 them from the array. How can I delete?

@@available_columns.delete(obj)
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Help concatenating letters and numbers

2008-11-12 Thread jemminger

you can use sprintf formatting for the integer:

 @integer1 = 10
 int_formatted = %06d % @integer1 # returns 10

I don't understand the other requirements enough to help further


On Nov 11, 6:21 pm, The Neurochild [EMAIL PROTECTED] wrote:
 Hello...

 I need to do the following in rails:

 I have a string with the following composition: AAA-BBB-2008-01

 The first to groups are strings, named @string1 and @string2. The
 third is the year, (reflected using Time.now.strftime(%Y)) and the
 last part is an integer, @integer1.

 I'm using a PostgreSQL 8 database and I need to put that composition
 on a string.I have no problem with the string variables and the year.
 The catch here is the integer, it increases everytime I do a new
 registry and, when a new year comes, it resets to 1. More over, I need
 the integer to be 6-digit.I don't know how to do that, but I know the
 logic of th increments:

 When the integer is 10, I need it to be 10; when it's 100, 000100;
 1000 = 001000 and so on.

 And let's suppose one of our string changes, for example. It also must
 resets the integer to 1.

 As you can see, it's a unique composition.

 As the id from the database keeps increasing, that number won't work
 on me. I need to set it apart, without using that number. And that
 count must be kept, whenever I log in to my app.

 Is it hard to do this stuff?

 Greetings...

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



[Rails] Re: Can't run tests using ruby 1.9.0 and rails 2.1.2

2008-11-12 Thread Jarl Friis

Frederick Cheung wrote:
 On 12 Nov 2008, at 11:32, Jarl Friis wrote:
 

 I have just created my first rails app
 After having modified the generator script (see
 http://rails.lighthouseapp.com/projects/8994/tickets/1176-scriptserver-make-an-error-in-ruby-19-because-of-defined-methods-change
 )
 I have created controller and I now try to run the generated test,  
 so I
 do:
 
 ruby 1.9 is somewhat in flux. You'll want to be on edge rails to use it.

Sorry english is not my native language and I am completely new ruby AND 
rails. What do you mean that ruby 1.9 is in flux.

By You'll want to be on edge rails to use it. I guess you mean that 
using the latest rails gem is not new enough to run stable on ruby 1.9, 
it might be necessary to run a nightly rails bulid, is that true?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: to_xml and helper methods

2008-11-12 Thread jemminger

In your model, you should just be able to include the helper:

class MyObject  ActiveRecord::Base
  include SomeHelper
end


On Nov 12, 9:02 am, Marcelo Barbudas [EMAIL PROTECTED] wrote:
 My problem is that the helper method, is a Helper(app/helpers)
 Method. :)

 And I can't use it in the model. Otherwise I could have called to_xml
 ( :method = etc).

 --
 M.

 On Nov 11, 9:50 pm, jemminger [EMAIL PROTECTED] wrote:

  modify theto_xmlmethod of your object, like so:

  class MyObject  ActiveRecord::Base
    def helper_method(obj)
      helper-methodsomething-from-obj-#{obj.id}/helper-method
    end

    defto_xml
      xml = super
      close_tag = /#{self.class.to_s.underscore.dasherize}
      xml.gsub(close_tag,   #{self.helper_method(self)}\n#{close_tag})
    end
  end

  On Nov 10, 10:15 am, Marcelo Barbudas [EMAIL PROTECTED] wrote:

   Hi,

   I have an array with objects and I want to generate an XML like:

   objects
     object
          category_id1/category_id
          helper-methodresult 1/helper-method
     /object
     object
          category_id2/category_id
          helper-methodresult 2/helper-method
     /object
   /objects

   The helper method generates some urls and it needs as an arguments the
   object.

   What would be a proper way to include the result of that method call?

   I guess building the xml manually could work, but that means I would
   have to manually enter every object variable.

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



[Rails] Re: How to revise array

2008-11-12 Thread Frederick Cheung


On 12 Nov 2008, at 13:47, Thani Ararsu wrote:



 After array initalization I want to revise several elements and  
 delete
 them from the array. How can I delete?

 @@available_columns.delete(obj)

reject, delete_if and friends are often useful too.

Fred

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



[Rails] Re: Can't run tests using ruby 1.9.0 and rails 2.1.2

2008-11-12 Thread Frederick Cheung


On 12 Nov 2008, at 14:12, Jarl Friis wrote:


 Frederick Cheung wrote:
 On 12 Nov 2008, at 11:32, Jarl Friis wrote:


 I have just created my first rails app
 After having modified the generator script (see
 http://rails.lighthouseapp.com/projects/8994/tickets/1176-scriptserver-make-an-error-in-ruby-19-because-of-defined-methods-change
 )
 I have created controller and I now try to run the generated test,
 so I
 do:

 ruby 1.9 is somewhat in flux. You'll want to be on edge rails to  
 use it.

 Sorry english is not my native language and I am completely new ruby  
 AND
 rails. What do you mean that ruby 1.9 is in flux.

It's changing. (and the latest is the 1.9.1 preview). Rails has been  
tracking it as best as it can, but the 2.1 branch was stabilised quite  
a while back


 By You'll want to be on edge rails to use it. I guess you mean that
 using the latest rails gem is not new enough to run stable on ruby  
 1.9,
 it might be necessary to run a nightly rails bulid, is that true?

Yes. (the 2.2 release candidate is probably ok too)

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

 


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



[Rails] How to revise array

2008-11-12 Thread Yan Oleg

I have the following code:

@@available_columns = [
QueryColumn.new(:tracker, :sortable =
#{Tracker.table_name}.position),
QueryColumn.new(:root_cause, :sortable =
#{RootCause.table_name}.position),
   QueryColumn.new(:project, :sortable = #{Project.table_name}.name),

.

]

After array initalization I want to revise several elements and delete
them from the array. How can I delete?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Action Specific Layouts

2008-11-12 Thread jemminger

perhaps a before or after filter to set it based on
controller.action_name ?


On Nov 11, 7:18 pm, Jason Pfeifer [EMAIL PROTECTED]
wrote:
 Greetings,

 I'm wondering if I can do action specific layouts in an elegant way like
 this:

 class AuthorsController  ApplicationController
   before_filter :is_admin?, :only = [:new, :create, :edit, :update,
 :destroy]

   layout admin, :except = [:index, :show]

   make_resourceful do
     actions :index, :show, :new, :create, :edit, :update
   end

 end

 I'm aware that you can do it in each action with:

 def index
   render :layout = layout
 end

 However, in a need to keep it clean I don't want to write that.  Looking
 at the layout method source, it appears that it should accept options.
 However, if I set :only or :except the layout is only correctly admin
 for the ones specified (or excepted), and the others render without a
 layout.

 Thoughts?

 Thanks,

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



[Rails] redirecting to a different controller from a search box

2008-11-12 Thread Vahagn

Hi,-

I have a main page with a search box. When the user enters a query and
hits Search I want to redirect him to another page (another
controller with a search action), and display the results on that
page. My form looks like this:

% form_tag({:controller = projects, :action =
search}, :method = get) do %
label for =qEnter search phrase: /label
%= text_field_tag q, params[:q] %
input type =submit value=Go /
% end %

The error I get is:

 ActiveRecord::RecordNotFound in ProjectsController#show

Couldn't find Project with ID=search

How do I override the default route for this, so it doesn't think
search is an id?

http://localhost:3000/projects/search?q=foo ?

Thanks.

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



[Rails] Re: Sort model based on max value of has_many field

2008-11-12 Thread Robert Walker

   def self.by_high_score
 self.all(
  :select = 'teams.id, teams.name, max(games.score)',
  :joins = 'left join games on team_id = teams.id',
  :group = 'teams.id',
  :order = 'score desc',
  :conditions = 'score is not null'
 )
   end
While this will probably work just fine, I would recommend caching the 
high score in a attribute of the Team model. This would be very similar 
to the counter_cache feature that Rails provides. This way your sorting 
could be handled by a very simple named route. It would also be many 
times more efficient since there is no join to deal with.

The trade-off is that you need additional logic to update the cached 
value when necessary, and in making sure that you always rely on your 
model's business logic to manage the cache. I personally think that the 
performance gained though this technique is well worth the trade-off in 
case where performance may be a significant factor.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Optimistic Locking and counters

2008-11-12 Thread Mattias Bud

Lets say:

1. User opens the post edit ui (which contains the control panel for the 
comments)
2. User edits the post but doesn't save
3. User destrys one comment through an ajax request
4. User tries to save the edit post

If I where to reload the post the users changes would go lost.


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

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



[Rails] Re: Simple Captcha

2008-11-12 Thread blasterpal

You should also check out negative capcha it is invisible to user
and offers a better experience. I have a few sites using this and I
think its worth a look too:

http://subwindow.com/articles/18


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



[Rails] Re: ROR switcher asks Does ROR offer CRUD form (admin interfaces) auto-generation for databases?

2008-11-12 Thread Peter Fitzgibbons
Yes, that's what scaffolding does (script/generate scaffold ..)
For further details, look into any of the Rails tutorials, and Dave Thomas'
book *Agile Web Development w/ Rails

*Peter Fitzgibbons
(847) 687-7646
Email: [EMAIL PROTECTED]
IM GTalk: peter.fitzgibbons
IM Yahoo: pjfitzgibbons
IM MSN: [EMAIL PROTECTED]
IM AOL: [EMAIL PROTECTED]


On Tue, Nov 11, 2008 at 11:13 PM, Micheal Cooper [EMAIL PROTECTED]wrote:


 I am currently using a very early framework called ERW, and I getting
 into Ruby so that I can recreate (with paid help) a very large college
 administration db app in Rails. Until relatively recently, I was going
 to do this in Django, and one reason for the choice was Django's
 excellent feature of automatically generating the basic CRUD forms
 (Django calls them admin forms) for a newly-created database. The
 framework I am using now also has this feature, though it is overly
 complex and difficult to maintain.

 I want to know if there is a feature in or add-on to Rails that looks
 at the database and creates customizable CRUD interfaces for all
 tables, including selectable foreign keys and filters, etc. Ideally,
 the forms would be scripts that can be filled-out and customized and
 only need to be recreated when the database has been changed.

 ERW's admin interface is PHP code that dynamically creates the forms
 when you call the script, and customization requires precise and
 redundant coding because generic scripts are used to create all the
 CRUD forms. For example, all admin list interfaces are done by
 list.php, so getting an admin list for table people requires going to
 'list.php?table=people'.

 I am hoping that ROR has a better way.

 --
 Micheal Cooper
 Miyazaki, Japan (GMT+9, no DST)

 


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



[Rails] Re: ROR switcher asks Does ROR offer CRUD form (admin interfaces) auto-generation for databases?

2008-11-12 Thread Philipe Farias

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



[Rails] Re: redirecting to a different controller from a search box

2008-11-12 Thread Thani Ararsu

Vahagn Hayrapetyan wrote:
 Hi,-
 
 I have a main page with a search box. When the user enters a query and
 hits Search I want to redirect him to another page (another
 controller with a search action), and display the results on that
 page. My form looks like this:
 
 % form_tag({:controller = projects, :action =
 search}, :method = get) do %
 label for =qEnter search phrase: /label
 %= text_field_tag q, params[:q] %
 input type =submit value=Go /
 % end %
 
 The error I get is:
 
  ActiveRecord::RecordNotFound in ProjectsController#show
 
 Couldn't find Project with ID=search
 
 How do I override the default route for this, so it doesn't think
 search is an id?
 
 http://localhost:3000/projects/search?q=foo ?
 
 Thanks.

you are useing get method
so the action name will passed as params[:id]
just remove get method
then try
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: ROR switcher asks Does ROR offer CRUD form (admin interfaces) auto-generation for databases?

2008-11-12 Thread Philipe Farias

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



[Rails] Re: Optimistic Locking and counters

2008-11-12 Thread Frederick Cheung


On 12 Nov 2008, at 14:55, Mattias Bud wrote:


 Yes it does.

Well if you don't do that you won't have this particular problem. Is  
that there in order to handle concurrent edits by multiple people ?

Fred

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

 


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



[Rails] Re: Nested forms with multiple models

2008-11-12 Thread Daniel Bush



On Nov 13, 12:40 am, jemminger [EMAIL PROTECTED] wrote:
 one suggestion:  don't put business logic in your views.  replace
 FlightTime.new with @flight_time and let your controller figure
 out if it should be a new or existing record.

 On Nov 12, 7:32 am, Alex Jonsson [EMAIL PROTECTED] wrote:
...

  Now this works perfectly when _adding_ FlightTimes as I'm using a
  FlightTime.new, but the issue I have is that I also want to be able to
  edit the values. When I try to use this form for editing, all the
  values in the boxes are emptied and anything I put in them are added
  as new FlightTimes (obviously). There can only be one FlightTime per
  FlightType per Flight, so to speak.


As per jemminger, if you want your action and template to both create
new objects and edit existing ones you need to put this logic into the
action in the controller.

So you might have:
  if params[:id]
@foo=Foo.find(params[:id])
  else
@foo=Foo.new
  end

In your view, you can then get rails to put whatever values are
currently in @foo into your fields:
  form_for :foo , :url ... do |f|
f.text_field :field1
...
  end

or:
  fields_for :foo do |f|
f.text_field :field1
...
  end

and rails will automagic in @foo.field1 as the value in that text
field because you specified ':foo'.
(Sorry, can't get my head around your models)

I was thinking that if you have an array of objects eg foo has_many
bars and you want to edit all those bars, then in the view you could
loop thru the array with an index eg:

  @foo.bars.each_with_index do |bar,idx|
fields_for bars[#{idx}] , bar do |b|
  b.text_field :field1
  ...
end
...
  end

Which, on submission, will generate
  params['bars']['0']['field1'] = some-value
  etc
Not sure if that's good but I think it works.
You could skip the whole 'with_index' thing if it's just has_one.

You'll also need to embed id value for each record into a hidden field
in your form if you're editing an existing item so that you can find
it and update it instead of creating a new object when the form is
submitted.
There are security implications here - people can post a random id
instead - so you need to think that through carefully.

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



[Rails] help with JQuery

2008-11-12 Thread César

Hi,
   have somebody experience using JQuery in an application Ror join to
prototype?
   somebody knows if is possible use Prototype and JQuery all together?

   I am trying implement drag and drop effects in a table but nothing
is happening. The javascript is not loaded. I found this two links
that I write below and I done all the steps but the effects didn't
appear in the proves.

http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/
http://www.bencurtis.com/archives/2008/10/drag-and-drop-sorting-with-jquery-and-rails/

can somebody tell me about another link or howto to see to fix this?

I have installed on the development machine :

System Debian GNU/Linux lenny
Rails 2.1.0-5


 Many thanks people. Bye

-- 
___
http://www.sindominio.net/ayuda/preguntas-inteligentes.html
http://cronopios.net/Traducciones/trolls.es.html
Gnu/Linux count user #416024

Pagina personal : http://www.cesardiaz.com.ar
Mi blog : http://cesarediaz.blogspot.com
Skype user : cesarstafe

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



[Rails] connection refused

2008-11-12 Thread xxmithila

what is the reason for this error. this return when try to direct web
page.

No connection could be made because the target machine actively
refused it. - connect(2)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] [ANN/ADV] Rails Training – Jan 20-23 – S an Antonio, TX

2008-11-12 Thread Brandon Keepers

Collective Idea, a Rails consulting and training company, has been
providing highly-praised Ruby on Rails training all over the world,
and now we're bringing it to San Antonio. We will be offering hands-on
Ruby on Rails training in downtown San Antonio on January 20-23

Visit our website for more information or contact me if you have any questions.

http://training.collectiveidea.com/ruby-on-rails

-- Brandon


Training by Collective Idea: Ruby on Rails training in a vacation setting
http://training.collectiveidea.com

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



[Rails] Re: Recommended Reading for..

2008-11-12 Thread Mohit Sindhwani

Bill Walton wrote:
 Hi Mojit,

 Mohit Sindhwani wrote:

   
 For one of my sites, I want to create a developer API so that other
 people can leverage of what we build to quickly put together their own
 solutions (I guess something like Google Maps is a good parallel
 example).  We'd like to control who uses it since we have data providers
 who would like to know when we pass data on to someone else.

 What would you recommend that I read?  It's fine if it's a book (doesn't
 need to be only online articles though those would give me a good start
 also).  [needless to say, Rails would be my preferred choice].
 


 I'd recommend picking up RESTful Web Services
 (http://www.amazon.com/RESTful-Web-Services-Leonard-Richardson/dp/0596529260
 ).  It gave me an expanded view; quickly.  Googling the same three words
 gives good results too.

 HTH,
 Bill
   
Thanks Bill - I shall take a look at that!

Cheers,
Mohit.
11/13/2008 | 12:22 AM.


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



[Rails] Re: Help! getting a can't dup NilClass error and don't know what to do about it.

2008-11-12 Thread eriwright



On Nov 12, 2:46 am, Frederick Cheung [EMAIL PROTECTED]
wrote:
 On 12 Nov 2008, at 09:56, eriwright wrote:



  Thanks for any help you can offer.

  I am trying to send out a small batch of emails using an http
  request.  I know it sounds odd. hear me out.

  I have loaded a bunch of emails into this table and just want to
  slowly work through them.  Sort of a poor mans AR:Mailer.  But I am
  getting a can't dup NilClass when I hit it with a http request.

 What's the stack trace ?

 Fred





  **
  def message
  [EMAIL PROTECTED] = Reminder.find(:all, :order = created_at DESC, :limit
  = 5)
     for reminder in @reminders
        ReminderMailer.deliver_reminder_message(reminder)
        reminder.destroy
      end
   render :nothing = true, :status = 401 # Unauhorized
  end
  

  I believe the Mailer class is working right.  Although when I remove
  the ReminderMailer line the rest of the method works fine.

  Please help if I am a million miles off on this and have some
  fundamental misunderstanding.  Please, please take the time to tell  
  me.
  


  smime.p7s
 3KViewDownload

Thank you for responding! here is the stack trace and while I am at it
I have included the ReminderMailer class at the bottom.

Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/
template_error.rb:11:in `dup'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/
template_error.rb:11:in `initialize'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:
322:in `new'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:
322:in `render_file'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:
348:in `render_without_active_scaffold'
/Library/Ruby/Gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/
base.rb:502:in `render'
/Library/Ruby/Gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/
base.rb:494:in `render_message'
/Library/Ruby/Gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/
base.rb:442:in `create!'
/Library/Ruby/Gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/
base.rb:403:in `initialize'
/Library/Ruby/Gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/
base.rb:352:in `new'
/Library/Ruby/Gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/
base.rb:352:in `method_missing'
app/controllers/reminders_controller.rb:32:in `message'
app/controllers/reminders_controller.rb:31:in `each'
app/controllers/reminders_controller.rb:31:in `message'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
base.rb:1158:in `send'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
base.rb:1158:in `perform_action_without_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
filters.rb:697:in `call_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
filters.rb:689:in `perform_action_without_benchmark'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
benchmarking.rb:68:in `perform_action_without_rescue'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
benchmarking.rb:68:in `perform_action_without_rescue'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
rescue.rb:199:in `perform_action_without_caching'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
caching.rb:678:in `perform_action'
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/
connection_adapters/abstract/query_cache.rb:33:in `cache'
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/
query_cache.rb:8:in `cache'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
caching.rb:677:in `perform_action'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
base.rb:524:in `send'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
base.rb:524:in `process_without_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
filters.rb:685:in `process_without_session_management_support'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
session_management.rb:123:in `process'
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
base.rb:388:in `process'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in
`process'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in
`synchronize'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in
`process'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in
`process_client'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in
`process_client'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
`initialize'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in 

[Rails] Can't run tests using ruby 1.9.0 and rails 2.1.2

2008-11-12 Thread Jarl Friis

I have just created my first rails app
After having modified the generator script (see
http://rails.lighthouseapp.com/projects/8994/tickets/1176-scriptserver-make-an-error-in-ruby-19-because-of-defined-methods-change
)
I have created controller and I now try to run the generated test, so I
do:

ruby -Itest test/functional/kml_controller_test.rb but I get

But it fails with the below message.

Any help is appriciated.

/var/lib/gems/1.9.0/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:510:
warning: nested repeat operator + and ? was replaced with '*'
Loaded suite test/functional/kml_controller_test
Started
/usr/lib/ruby/1.9.0/test/unit/ui/console/testrunner.rb:94:in `sub!':
can't modify frozen string (RuntimeError)
from
/usr/lib/ruby/1.9.0/test/unit/ui/console/testrunner.rb:94:in
`test_started'
from /usr/lib/ruby/1.9.0/test/unit/util/observable.rb:78:in
`call'
from /usr/lib/ruby/1.9.0/test/unit/util/observable.rb:78:in
`block in notify_listeners'
from /usr/lib/ruby/1.9.0/test/unit/util/observable.rb:78:in
`each'
from /usr/lib/ruby/1.9.0/test/unit/util/observable.rb:78:in
`notify_listeners'
from
/usr/lib/ruby/1.9.0/test/unit/ui/testrunnermediator.rb:47:in `block in
run_suite'
from
/var/lib/gems/1.9.0/gems/activesupport-2.1.2/lib/active_support/testing/setup_and_teardown.rb:28:in
`run_with_callbacks'
from /usr/lib/ruby/1.9.0/test/unit/testsuite.rb:34:in `block in
run'
from /usr/lib/ruby/1.9.0/test/unit/testsuite.rb:33:in `each'
from /usr/lib/ruby/1.9.0/test/unit/testsuite.rb:33:in `run'
from /usr/lib/ruby/1.9.0/test/unit/testsuite.rb:34:in `block in
run'
from /usr/lib/ruby/1.9.0/test/unit/testsuite.rb:33:in `each'
from /usr/lib/ruby/1.9.0/test/unit/testsuite.rb:33:in `run'
from
/usr/lib/ruby/1.9.0/test/unit/ui/testrunnermediator.rb:46:in `run_suite'
from
/usr/lib/ruby/1.9.0/test/unit/ui/console/testrunner.rb:67:in
`start_mediator'
from
/usr/lib/ruby/1.9.0/test/unit/ui/console/testrunner.rb:41:in `start'
from
/usr/lib/ruby/1.9.0/test/unit/ui/testrunnerutilities.rb:29:in `run'
from /usr/lib/ruby/1.9.0/test/unit/autorunner.rb:216:in `run'
from /usr/lib/ruby/1.9.0/test/unit/autorunner.rb:12:in `run'
from /usr/lib/ruby/1.9.0/test/unit.rb:278:in `block in top
(required)'
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Getting the friends contacts mail Id of gmail,hotmail,ya

2008-11-12 Thread Smarty 2k

hi,

Please help me!

am using ruby-1.8.6
  gem blackbook-1.0.4

output is @contacts.inspect(collection of Emails and name)

I got this error :
undefined method `name' for {:email=[EMAIL PROTECTED], :name=aaa}:Hash

please give me further solution. please

Thankyou.

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

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



[Rails] Re: is it possible in rails ?

2008-11-12 Thread Thorsten Müller

That's not possible in any web framework.
Browsers don't allow for the drag/drop thing,
for security reasons I guess.

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



[Rails] Re: how to retrive multiple vaules from a view for a text_field!

2008-11-12 Thread Raji Mani

Frederick Cheung wrote:
 On Nov 12, 5:18�am, Raji Mani [EMAIL PROTECTED]
 wrote:

 issue is how do i differentiate radio buttons with the same name.. both
 the radio buttons are getting selected :(.. here is the code

 the builders yielded by form_for and fields_for have the same name, so
 they'll be overwriting each other (which isn't what I thing you want).
 Also shouldn't the second parameter to radio_button be index and not
 'index' ?
 
 Fred

ya. got it. But there exists an issues.. When i select radio button i ll 
get the following error. . undefined method `values' for 1:String 
where as the other values get saved if i do not select radio button.

Also If i enter only one email id the form is not getting saved. 
Controller is as follows.

 def new
   @contact = Contact.new
   2.times  { @contact.emails.build }
 end
 def create
   @contact = Contact.new(params[:contact])
  params[:email].each_value do |email|
  @contact.emails.build(email) unless email.values.all?(:blank?)
  end
   if @contact.save
   flash[:notice] = Successfully created new  Contact.!
 redirect_to :action = 'list'
   else
 render :action = 'new'
   end
 end

Where i went wrong?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] ASP.NET to Rails with MySQL

2008-11-12 Thread Shilo Ayalon

Hi -

I'm thinking about porting an ASP.NET app to rails. This will require
complete re-write of the site's code, and I'm fine with it. With ASP.NET
I use a lot of MySQL views constructed from tables, and I wondered how I
could do this with rails.

I just started reading about RoR since I heard a lot of good things
about it and wanted a piece of the action. I'm really resisting the urge
to go with Django, even though I have a solid background with python
(any thoughts?). Thing is, I'm really used to formulating my own DB
queries, and rails handles all of those behind the scenes -- not
necessarily a bad thing, just need to get used to it. My question is, is
there a way to build rails apps with explicit queries, or mix
ActiveRecord action with those? I'd love to some feedback. Thanks!
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Optimistic Locking and counters

2008-11-12 Thread Mattias Bud

Frederick Cheung wrote:
 On 12 Nov 2008, at 14:55, Mattias Bud wrote:
 

 Yes it does.
 
 Well if you don't do that you won't have this particular problem. Is
 that there in order to handle concurrent edits by multiple people ?
 
 Fred

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

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



[Rails] What's the cleanest way to add have a start / stop control with EventMachine

2008-11-12 Thread Rob Lacey

Hi there,

I'm new to playing with EventMachine and I wondered if anyone has a nice 
way of backgrounding it and start / stopping it from the command line 
like an init script.

e.g. ./mydaemon start|stop

I've not seen an example of this and search through the Juggernaut gem 
source I couldn't get the come I'd stolen from it to work with a basic 
echo server.

e.g. mydaemon start|stop

Any ideas?

RobL

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



[Rails] Re: Optimistic Locking and counters

2008-11-12 Thread Frederick Cheung


On 12 Nov 2008, at 12:06, Mattias Bud wrote:


 This is because I in my edit view of the post also have a control  
 panel
 for managing the comments (ajax). If a comment here is removed  
 (without
 reloading the page and then also the post) the posts counter cache is
 updated alongside with its lock_version. If I then try to save the  
 post
 its stale (StaleObjectError).

 So I'm looking for a way to be able to update the comments counter  
 cache
 on the post model without changing the lock_version.


I think you're better off fixing this properly than hacking around  
with lock_version. If you post the salient parts of the code someone  
might be able to offer a suggestion.

Fred


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

 


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



[Rails] Re: Help! getting a can't dup NilClass error and don't know what to do about it.

2008-11-12 Thread eriwright



On Nov 12, 8:53 am, Frederick Cheung [EMAIL PROTECTED]
wrote:
 On 12 Nov 2008, at 16:34, eriwright wrote:



  Thank you for responding! here is the stack trace and while I am at it
  I have included the ReminderMailer class at the bottom.

 I bet you reminder.body is nil.

 Fred


I bow to your superior intellect... lol seriously Thank you, thats
exactly what the problem was, you are a gentleman and a scholar
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: how to retrive multiple vaules from a view for a text_field!

2008-11-12 Thread Frederick Cheung


On 12 Nov 2008, at 10:13, Raji Mani wrote:


 Frederick Cheung wrote:
 On Nov 12, 5:18�am, Raji Mani [EMAIL PROTECTED]
 wrote:

 issue is how do i differentiate radio buttons with the same name..  
 both
 the radio buttons are getting selected :(.. here is the code

 the builders yielded by form_for and fields_for have the same name,  
 so
 they'll be overwriting each other (which isn't what I thing you  
 want).
 Also shouldn't the second parameter to radio_button be index and not
 'index' ?

 Fred

 ya. got it. But there exists an issues.. When i select radio button  
 i ll
 get the following error. . undefined method `values' for 1:String
 where as the other values get saved if i do not select radio button.

 From the code I'd guess that you end up with params[:email]  
containing the string 1, which you then try and call values on.


Fred
 Also If i enter only one email id the form is not getting saved.
 Controller is as follows.

 def new
   @contact = Contact.new
   2.times  { @contact.emails.build }
 end
 def create
   @contact = Contact.new(params[:contact])
  params[:email].each_value do |email|
  @contact.emails.build(email) unless email.values.all?(:blank?)
  end
   if @contact.save
   flash[:notice] = Successfully created new  Contact.!
 redirect_to :action = 'list'
   else
 render :action = 'new'
   end
 end

 Where i went wrong?
 -- 
 Posted via http://www.ruby-forum.com/.

 


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



[Rails] Nested forms with multiple models

2008-11-12 Thread Alex Jonsson

Hey guys, I need your help again!

I have a form in which I want to nest multiple models. Kind of like a
project has many tasks but rather a flight has one flight time per
flight type.

So it's three models - Flight, FlightType and FlightTime. Flight -
FlightTime - FlightType

What I want to do is to loop through the FlightTypes in the add/edit
Flight form, and present a text box whose value then will be stored
as :hours in a FlightTime along with a :flight_id and :flight_type_id
value. I hope I've made myself clear.

This is the code I have in my flight_form view currently:

http://pastie.org/312947

Now this works perfectly when _adding_ FlightTimes as I'm using a
FlightTime.new, but the issue I have is that I also want to be able to
edit the values. When I try to use this form for editing, all the
values in the boxes are emptied and anything I put in them are added
as new FlightTimes (obviously). There can only be one FlightTime per
FlightType per Flight, so to speak.

So, anyone up for the task to help me out?

Thanks,
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: images / stylesheets not loading

2008-11-12 Thread Philip Hallstrom


On Nov 11, 2008, at 12:08 PM, Marli Ba wrote:


 when I use image_tag or a stylesheet tag, the underlying images or
 stylesheets aren't loading.  Everything used to work properly, but I  
 ran
 into some errors and have had to change some settings, but nothing
 relating to image_tag or the stylesheet tag.


 It produces this error in the log when trying to process the image:

 -log/development.rb-
 Processing CatalogController#unknown_request (for 71.16.212.90 at
 2008-11-11 13:02:03) [GET]
  Session ID: 107f3aa7e7cd544111699d9180b38916
  Parameters: {action=unknown_request, controller=catalog,
 remainder=[images, products, 107-440.jpg]}
 Rendering template within layouts/catalog
 Rendering catalog/unknown_request
 Completed in 0.00398 (251 reqs/sec) | Rendering: 0.00210 (52%) | DB:
 0.00022 (5%) | 200 OK
 [http://www.mywebsite.com/bpc/images/products/107-440.jpg]
 ---

 my image tag usage seems to be correct:

 --product.html.erb-
  % if [EMAIL PROTECTED] %
div class='product_picture'
% @product.pictures.each do |picture| %
  %= image_tag(picture.location) %
% end %
/div
  % end %
 ---

 and here is the resulting html:

 ---
div class='product_picture'
  img alt=107-440 src=/bpc/images/products/107-440.png /
  img alt=107-440 src=/bpc/images/products/107-440.jpg /
/div
 ---


 I really am lost over what i need to do to fix this.  Any ideas?  It
 looks like it's now treating the image_tag as a url request somehow  
 and
 sending it into my catchall unknown_request route.

I realize this might be obvious, but does RAILS_ROOT/public/bpc/images/ 
products/107-440.png exist in the filesystem?

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



[Rails] Re: Link to mysql.sock deleted at reboot

2008-11-12 Thread Craig

On Nov 12, 4:05 am, Pål Bergström [EMAIL PROTECTED]
wrote:
 Frederick Cheung wrote:
  On 12 Nov 2008, at 09:32, Pål Bergström wrote:

  s.net

  I could do that, but it's convenient to use /tmp/mysql.sock as other
  programs look there first.

  Presumably you can configure mysql to put its socket in /tmp rather
  than in /opt/...

  Fred

 True. But not sure my skills are up to that. Yet another thing to figure
 out :-)

 I think I'll try to make a applecsript/shell script that runs at
 startup. I've done something similar before.

 Thanks for the help.



Here are a couple of articles I used to help me get Rails  MySql
running on Leopard.

http://forums.macrumors.com/showthread.php?s=7cfca6058e0cdd924e57df37ed1be5a7p=4394679#post4394679

http://hivelogic.com/articles/2008/02/ruby-rails-leopard

hth,

Craig

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



[Rails] Help! getting a can't dup NilClass error and don't know what to do about it.

2008-11-12 Thread eriwright

Thanks for any help you can offer.

I am trying to send out a small batch of emails using an http
request.  I know it sounds odd. hear me out.

I have loaded a bunch of emails into this table and just want to
slowly work through them.  Sort of a poor mans AR:Mailer.  But I am
getting a can't dup NilClass when I hit it with a http request.

**
def message
  @reminders = Reminder.find(:all, :order = created_at DESC, :limit
= 5)
for reminder in @reminders
   ReminderMailer.deliver_reminder_message(reminder)
   reminder.destroy
 end
  render :nothing = true, :status = 401 # Unauhorized
 end


I believe the Mailer class is working right.  Although when I remove
the ReminderMailer line the rest of the method works fine.

Please help if I am a million miles off on this and have some
fundamental misunderstanding.  Please, please take the time to tell 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Optimistic Locking and counters

2008-11-12 Thread Frederick Cheung


On 12 Nov 2008, at 12:30, Mattias Bud wrote:


 Something like this

 p = Post.find(1)

 c = p.comments.first
 c.destory

 p.save
 StaleObjectError

 This fails because the counter cache of comments in the post model is
 now changed.

 Anyway around this?


OK. So first off suppressing the increment of lock_version would  
probably meant that your counter cache value would get stomped on  
(although with partial updates in 2.1 you might get away with it).
the easiest way would be to reload p after having done stuff to  
comments, or alternatively you might be able to do the stuff you need  
to do to p before you play with the comments.
Yet another way might be to do stuff to c.post instead of doing them  
to p.

Fred

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



[Rails] Re: Getting the friends contacts mail Id of gmail,hotmail,ya

2008-11-12 Thread Smarty 2k


hi,

Please help me!

am using ruby-1.8.6
  gem blackbook-1.0.4

output is @contacts.inspect(collection of Emails and name)

please give me further solution. please

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

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



[Rails] Using Active Resource in ROR Application

2008-11-12 Thread Shripad

Hi all,

I want to use Active Resource to communicate with other application.
How can i use Active Resource in my ROR application.
anyone knows please help me out.


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



[Rails] Re: Optimistic Locking and counters

2008-11-12 Thread Peter Fitzgibbons
Why do you care about version_lock value?  That field is really for the AR
internal recordkeeping part of optimistic locking.
In .NET, this type of control is handled with a GUID, just to point out that
the field value itself is useless outside of the scope of the locking
mechanism.

Your thoughts?

Peter Fitzgibbons
(847) 687-7646
Email: [EMAIL PROTECTED]
IM GTalk: peter.fitzgibbons
IM Yahoo: pjfitzgibbons
IM MSN: [EMAIL PROTECTED]
IM AOL: [EMAIL PROTECTED]


On Wed, Nov 12, 2008 at 3:42 AM, Mattias Bud 
[EMAIL PROTECTED] wrote:


 Hi

 I have a model which both have optimistic locking and a counter. Is
 there any way to disable the version auto increment when only the
 counter is updated?

 Lets say I have a post which has many comments. When I add a comment I
 don't want the version_lock to be incremented. This happens now because
 the post has a comments_count column.

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

 


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



[Rails] Re: Optimistic Locking and counters

2008-11-12 Thread Mattias Bud

This is because I in my edit view of the post also have a control panel 
for managing the comments (ajax). If a comment here is removed (without 
reloading the page and then also the post) the posts counter cache is 
updated alongside with its lock_version. If I then try to save the post 
its stale (StaleObjectError).

So I'm looking for a way to be able to update the comments counter cache 
on the post model without changing the lock_version.




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

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



[Rails] Re: to_xml and helper methods

2008-11-12 Thread Marcelo Barbudas

My problem is that the helper method, is a Helper(app/helpers)
Method. :)

And I can't use it in the model. Otherwise I could have called to_xml
( :method = etc).

--
M.

On Nov 11, 9:50 pm, jemminger [EMAIL PROTECTED] wrote:
 modify theto_xmlmethod of your object, like so:

 class MyObject  ActiveRecord::Base
   def helper_method(obj)
     helper-methodsomething-from-obj-#{obj.id}/helper-method
   end

   defto_xml
     xml = super
     close_tag = /#{self.class.to_s.underscore.dasherize}
     xml.gsub(close_tag,   #{self.helper_method(self)}\n#{close_tag})
   end
 end

 On Nov 10, 10:15 am, Marcelo Barbudas [EMAIL PROTECTED] wrote:

  Hi,

  I have an array with objects and I want to generate an XML like:

  objects
    object
         category_id1/category_id
         helper-methodresult 1/helper-method
    /object
    object
         category_id2/category_id
         helper-methodresult 2/helper-method
    /object
  /objects

  The helper method generates some urls and it needs as an arguments the
  object.

  What would be a proper way to include the result of that method call?

  I guess building the xml manually could work, but that means I would
  have to manually enter every object variable.

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



[Rails] Re: Optimistic Locking and counters

2008-11-12 Thread Frederick Cheung


On 12 Nov 2008, at 13:21, Mattias Bud wrote:


 This was just to show the problem. The UI prevents me from reloading  
 p.

That doesn't quite make sense to me. How can the ui stop you from  
doing p.reload ? (or any of the other suggestions i made?)

Fred

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

 


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



[Rails] Re: Optimistic Locking and counters

2008-11-12 Thread Mattias Bud

Something like this

p = Post.find(1)

c = p.comments.first
c.destory

p.save
StaleObjectError

This fails because the counter cache of comments in the post model is 
now changed.

Anyway around this?




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

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



[Rails] Getting the friends contacts mail Id of gmail,hotmail,yahoo

2008-11-12 Thread Smarty 2k

hi,

Please help me!

am using ruby-1.8.6
  gem blackbook-1.0.4

output is @contacts.inspect(collection of Emails and name)

I got this error :
undefined method `name' for {:email=[EMAIL PROTECTED], :name=aaa}:Hash

please give me further solution. please

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

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



[Rails] How to get hash values????

2008-11-12 Thread Smarty 2k

Hi,
please help me

% puts Total [EMAIL PROTECTED] %

My Output is: Total [{:email=[EMAIL PROTECTED], :name=aa},
{:email=[EMAIL PROTECTED], :name=bb}]

How to get email and name???

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

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



[Rails] Some optimization hacks: your opinion?

2008-11-12 Thread Enrico Thierbach

Hi everyone,

I found and tried two optimization hacks; however, I don't feel too
comfortable with them. Therefore I would appreciate your opinion:

- Caching proc objects, i.e.

  class Symbol
def to_proc
  @to_proc ||= Proc.new { |*args| args.shift.__send__(self, *args) }
end
  end

- and disabling the GC during an action:

  around_filter do |controller, action|
GC.disable
begin
  action.call
ensure
  GC.enable
  GC.start
end
  end

On some of our machines and with some requests they boost performance
by as much as 50%. however, as I don't know if I shuld feel ssave with
them I would like to hear your opinions.

BTW: A longer version of this text, with some explanation, is here:
http://1rad.wordpress.com/2008/11/10/0x0a-some-optimization-hacks/

/eno

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



[Rails] NoMethodError on UserMailer:Class

2008-11-12 Thread Grayson Piercee

I'm baffled but this error:

NoMethodError: undefined method `application_accepted' for
UserMailer:Class
from
c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer
/base.rb:385:in `method_missing'
from D:/rails/app/models/applicant_observer.rb:11:in `after_
save'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record
/observer.rb:171:in `send'
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record
/observer.rb:171:in `update'
from c:/ruby/lib/ruby/1.8/observer.rb:185:in `notify_observers'
from c:/ruby/lib/ruby/1.8/observer.rb:184:in `each'
from c:/ruby/lib/ruby/1.8/observer.rb:184:in `notify_observers'

here is the class in question

require 'action_mailer/ar_mailer'
class UserMailer  ActionMailer::ARMailer

  def signup_notification(user)
setup_email(user)
@subject+= 'Welcome to'
  end

  def application_accepted(application)
setup_email(application.position.account)
@subject += #{application.name} accepted.
@body[:application] = application
  end

  protected
  def setup_email(user)
recipients #{user.email}
from   FROM_MAILER_STRING # Sets the User FROM Name and Email
subject 
body   :user = user
sent_onTime.now
  end
end

end


signup_notification works fine why would this other method?

Thanks,

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

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



[Rails] Re: InvalidAuthenticityToken error only in IE

2008-11-12 Thread Mike

Hi,
i've got the same problem. i cant find any fix for it neither can i
reproduce it. it just sometimes works.
Mike

On 12 Nov., 05:44, Sam Kong [EMAIL PROTECTED] wrote:
 Hi,

 I am developing a web site using rails 2.1.2.
 I'm using restful_authentication.
 I get InvalidAuthenticityToken error at login in IE  Safari.
 Firefox works fine.

 What's wrong?

 Thanks.

 Sam

 Full trace:

 vendor/rails/actionpack/lib/action_controller/request_forgery_protection.rb:86:in
 `verify_authenticity_token'
 vendor/rails/activesupport/lib/active_support/callbacks.rb:173:in `send'
 vendor/rails/activesupport/lib/active_support/callbacks.rb:173:in
 `evaluate_method'
 vendor/rails/activesupport/lib/active_support/callbacks.rb:161:in `call'
 vendor/rails/actionpack/lib/action_controller/filters.rb:191:in `call'
 vendor/rails/actionpack/lib/action_controller/filters.rb:591:in
 `run_before_filters'
 vendor/rails/actionpack/lib/action_controller/filters.rb:577:in
 `call_filters'
 vendor/rails/actionpack/lib/action_controller/filters.rb:572:in
 `perform_action_without_benchmark'
 vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in
 `perform_action_without_rescue'
 /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
 vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in
 `perform_action_without_rescue'
 vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in
 `perform_action_without_caching'
 vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in
 `passenger_orig_perform_action'
 vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in
 `cache'
 vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache'
 vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in
 `passenger_orig_perform_action'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/railz/request_handler.rb:53:in
 `perform_action'
 vendor/rails/actionpack/lib/action_controller/base.rb:529:in `send'
 vendor/rails/actionpack/lib/action_controller/base.rb:529:in
 `process_without_filters'
 vendor/rails/actionpack/lib/action_controller/filters.rb:568:in
 `process_without_session_management_support'
 vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in
 `process'
 vendor/rails/actionpack/lib/action_controller/base.rb:389:in `process'
 vendor/rails/actionpack/lib/action_controller/dispatcher.rb:149:in
 `handle_request'
 vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in
 `dispatch'
 vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in
 `synchronize'
 vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in
 `dispatch'
 vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in
 `dispatch_cgi'
 vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in
 `dispatch'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/railz/request_handler.rb:38:in
 `process_request'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_request_handler.rb:163:in
 `main_loop'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/railz/application_spawner.rb:307:in
 `start_request_handler'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/railz/application_spawner.rb:276:in
 `handle_spawn_application'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/utils.rb:165:in
 `safe_fork'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/utils.rb:163:in
 `fork'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/utils.rb:163:in
 `safe_fork'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/railz/application_spawner.rb:274:in
 `handle_spawn_application'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/utils.rb:165:in
 `safe_fork'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/utils.rb:163:in
 `fork'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/utils.rb:163:in
 `safe_fork'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/railz/application_spawner.rb:273:in
 `handle_spawn_application'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb:317:in
 `__send__'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb:317:in
 `main_loop'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb:168:in
 `start_synchronously'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb:135:in
 `start'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb:112:in
 `fork'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/abstract_server.rb:112:in
 `start'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/railz/application_spawner.rb:177:in
 `start'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/spawn_manager.rb:218:in
 `spawn_rails_application'
 /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/lib/passenger/spawn_manager.rb:213:in
 `synchronize'
 

[Rails] Re: Number formatter

2008-11-12 Thread Gavin Kistner

[EMAIL PROTECTED] wrote:
 Does anyone know if the reverse of the rails 20.kilobytes (megabytes/
 gigabytes etc.) exists? I have lots of values in my model that are
 stored as bytes and I'd like to easily convert them to a MB or GB
 approximation (say 1 decimal place) with *B as a suffix after the
 number.

This reply is over a year old, but I thought I'd archive the information 
in this thread.

While ActionView in rails does have a helper for this, it requires you 
to supply the number of decimal places. What follows is my own code (as 
a Ramaze helper) that (by default) automatically determines the number 
of decimal places based on the size of the answer.

For example:
[ 1500 12_000 130_000 1_400_000 ].each do |bytes|
  puts nice_bytes( b )
end
#= 1.46kB
#= 11.7kB
#= 127kB
#= 1.34MB

module Ramaze::Helper::NiceBytes
  K = 2.0**10
  M = 2.0**20
  G = 2.0**30
  T = 2.0**40
  def nice_bytes( bytes, max_digits=3 )
value, suffix, precision = case bytes
  when 0...K
[ bytes, 'b', 0 ]
  else
value, suffix = case bytes
  when K...M : [ bytes / K, 'kB' ]
  when M...G : [ bytes / M, 'MB' ]
  when G...T : [ bytes / G, 'GB' ]
  else [ bytes / T, 'TB' ]
end
used_digits = case value
  when   0...10   : 1
  when  10...100  : 2
  when 100...1000 : 3
end
leftover_digits = max_digits - used_digits
[ value, suffix, leftover_digits  0 ? leftover_digits : 0 ]
end
%.#{precision}f#{suffix} % value
  end
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Search multiple tables

2008-11-12 Thread bob

Thanks.  I just gave ultrasphinx a try, and it looks promising.  I'm
also considering looking into solr.

Do you have any advice as to how the two stack up?

Thanks again!

On Nov 11, 2:08 am, Thorsten Müller [EMAIL PROTECTED] wrote:
 This may depend on the actual number of tables to search,
 and on the kind of search.

 If it's only two or three, I would go for ActiveRecords :join
 or :include
 If that gets too complicated I would use pure SQL.
 Another option would be a search engine like sphinx.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Where to put custmized files in Rails app?

2008-11-12 Thread [EMAIL PROTECTED]

I may not want to have a directory of files anywhere that much but,
what if I want to separate my *rb files from *xml files? The case I am
having now is that I have to put all my own files in a signal lib
directory which I may not like it very much. Is this ture that I
cannot have a sub directory in lib?



On Nov 12, 8:13 am, jemminger [EMAIL PROTECTED] wrote:
 The lib directory is included by rails automatically, so any file in
 there will be included.  If you put it elsewhere you'll have to
 specifically require them yourself.

 On Nov 11, 11:52 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
 wrote:



  Thank you for the response.

  I am practicing on v1.7 and it works fine. But, if I move the code
  from components to comp dir in lib, the controller can not fine those
  fine any more. If I put those files in lib directly, it woks fine
  again. How can I maintain a structure of directories in Rails?

  Thanks,

  -

  On Nov 11, 4:15 pm, jemminger [EMAIL PROTECTED] wrote:

   the components dir is deprecated and removed in v2.0+ AFAIK

   you'd be better off using the lib dir or making a plugin.

   On Nov 11, 1:35 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
   wrote:

All,

This is the first time to play on Rails application. Simple questions:
where to locate/store my own *.rb, and *.txt files in my Rails app?
I put my *.rb in the components folder so that controllers can see
them without problems. Is this the right place to do that?
But I may not know where to put *.txt files and how to locate them in
controllers.

Thank you in advance.
-- Hide quoted text -

   - Show quoted text -- Hide quoted text -

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



[Rails] Re: Can't run tests using ruby 1.9.0 and rails 2.1.2

2008-11-12 Thread Jarl Friis


Thanks for the response.

Frederick Cheung wrote:
 On 12 Nov 2008, at 14:12, Jarl Friis wrote:
 
 so I
 do:

 ruby 1.9 is somewhat in flux. You'll want to be on edge rails to  
 use it.

 Sorry english is not my native language and I am completely new ruby  
 AND
 rails. What do you mean that ruby 1.9 is in flux.

 It's changing. (and the latest is the 1.9.1 preview). Rails has been
 tracking it as best as it can, but the 2.1 branch was stabilised quite
 a while back

Changing??? 1.9.0 is a frozen released piece of software. development is 
going on for the next release 1.9.1, so I am a bit confused.

A while back??? As far as I understand Ruby 1.9.0 was released 
2007-12-25 and Rails 2.1.0 was released 2008-05-31 and rails 2.1.{1,2} 
even later, so is there a reason why rails 2.1.{0,1,2} was not 
stabalised on the latest (at time of release) stable ruby (which was 
1.9.0 for all three rails releases)

Does that mean that I shouldn't expect 2.1.x series to be running on 
ruby 1.9.0 at all? and what about 2.2.x series.

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

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



[Rails] Re: Multiple views with same controller

2008-11-12 Thread Mario Peterscheck

What about adding different actions to it (e.g. privacy, account, 
userdata)?

I do have that right now in routes:

map.resources :users, :member = { :enable = :put } do |users|
users.resources :roles
users.resources :photos, :name_prefix = 'user_', :controller = 
'user_photos'
users.resources :friends
users.resources :gardens
  end

means adding: { :enable = :put, :privacy = :get, :account = :get, 
:userdata = :get }

and then I create a new view for the depending actions?

What about calling a GET? Isn't the update a PUT? Which of those to take 
care about?

Being perfect the URL should look like 
http://localhost:3000/users/7/privacy;
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] BDD with webrat and Cucumber

2008-11-12 Thread James Byrne

OS = CentOS-5.2
Ruby 1.8.6
Rails 2.2.0RC1
Cucumber 0.1.9
Webrat 0.3.2

I have asked about this on the RSpec list but I am repeating my request
here to reach a somewhat wider audience.

I am running a cucumber feature test that invokes webrat.  The step is
defined as follows:

Given /I am on the new entity page/ do
  visits /entities/new
end

# rake features then generates the following error:

  Scenario: Register a new entity  #
features/manage_entities.feature:7
Given I am on the new entity page  #
features/steps/entity_steps.rb:1
  wrong number of arguments (3 for 1) (ActionView::TemplateError)
  On line #10 of app/views/entities/new.html.erb

  7: % form_for(@entity) do |f| %
  8:
  9:   %= render  :partial  = 'entities/entity_header',
  10:   :object   = @entity -%
  11:
  12:   p
  13:   %= f.submit Create -%

  
vendor/plugins/rspec-rails/lib/spec/rails/extensions/action_view/base.rb:13:in
`render_partial'


This code actually works without error but I infer that I am tripping
over some assumptions that webrat makes about views.  Is what I have
done wrong obvious to anyone here?

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

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



[Rails] Re: How to get the list of installed plugins?

2008-11-12 Thread jemminger

doh, run from your rails app root:

  list = Dir[vendor/plugins/*]



On Nov 12, 11:37 am, Jej [EMAIL PROTECTED] wrote:
 Thanks for that, but this command doesn't list the plugins I have
 under /myapp/vendor/plugins

 I need this to make an about page that gives the rails version,
 installed plugins, etc.

  ruby script/plugin list

  On Nov 12, 5:22 am, Jej [EMAIL PROTECTED] wrote:

   Hi all,

   Is there a simple way to get a list of installed plugins in an app? I
   need name and version of each running plugin. I saw some methods in
   the API, but related to the loading of plugins.

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



[Rails] Re: NoMethodError on UserMailer:Class

2008-11-12 Thread jemminger

make sure you're calling it via
UserMailer.create_application_accepted or
UserMailer.deliver_application_accepted, not just
UserMailer.application_accepted

On Nov 12, 1:21 pm, Grayson Piercee [EMAIL PROTECTED]
wrote:
 I'm baffled but this error:

 NoMethodError: undefined method `application_accepted' for
 UserMailer:Class
         from
 c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.1/lib/action_mailer
 /base.rb:385:in `method_missing'
         from D:/rails/app/models/applicant_observer.rb:11:in `after_
 save'
         from
 c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record
 /observer.rb:171:in `send'
         from
 c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record
 /observer.rb:171:in `update'
         from c:/ruby/lib/ruby/1.8/observer.rb:185:in `notify_observers'
         from c:/ruby/lib/ruby/1.8/observer.rb:184:in `each'
         from c:/ruby/lib/ruby/1.8/observer.rb:184:in `notify_observers'

 here is the class in question

 require 'action_mailer/ar_mailer'
 class UserMailer  ActionMailer::ARMailer

   def signup_notification(user)
     setup_email(user)
     @subject    += 'Welcome to'
   end

   def application_accepted(application)
     setup_email(application.position.account)
     @subject += #{application.name} accepted.
     @body[:application] = application
   end

   protected
   def setup_email(user)
     recipients #{user.email}
     from       FROM_MAILER_STRING # Sets the User FROM Name and Email
     subject     
     body       :user = user
     sent_on    Time.now
   end
 end

 end

 signup_notification works fine why would this other method?

 Thanks,

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



[Rails] Re: Where to put custmized files in Rails app?

2008-11-12 Thread jemminger

you can have as many subdirectories in lib or anywhere else you want.
you will just have to explicitly require those files or write
something to auto-require the files in those dirs.

e.g. if you make lib/myfiles/foo.rb, you'll have to put require
'myfiles/foo.rb' to use it

On Nov 12, 1:41 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
 I may not want to have a directory of files anywhere that much but,
 what if I want to separate my *rb files from *xml files? The case I am
 having now is that I have to put all my own files in a signal lib
 directory which I may not like it very much. Is this ture that I
 cannot have a sub directory in lib?

 On Nov 12, 8:13 am, jemminger [EMAIL PROTECTED] wrote:





  The lib directory is included by rails automatically, so any file in
  there will be included.  If you put it elsewhere you'll have to
  specifically require them yourself.

  On Nov 11, 11:52 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
  wrote:

   Thank you for the response.

   I am practicing on v1.7 and it works fine. But, if I move the code
   from components to comp dir in lib, the controller can not fine those
   fine any more. If I put those files in lib directly, it woks fine
   again. How can I maintain a structure of directories in Rails?

   Thanks,

   -

   On Nov 11, 4:15 pm, jemminger [EMAIL PROTECTED] wrote:

the components dir is deprecated and removed in v2.0+ AFAIK

you'd be better off using the lib dir or making a plugin.

On Nov 11, 1:35 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:

 All,

 This is the first time to play on Rails application. Simple questions:
 where to locate/store my own *.rb, and *.txt files in my Rails app?
 I put my *.rb in the components folder so that controllers can see
 them without problems. Is this the right place to do that?
 But I may not know where to put *.txt files and how to locate them in
 controllers.

 Thank you in advance.
 -- Hide quoted text -

- Show quoted text -- Hide quoted text -

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



[Rails] Re: Optimistic Locking and counters

2008-11-12 Thread Mattias Bud

This was just to show the problem. The UI prevents me from reloading p.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: how ruby script/server work

2008-11-12 Thread jemminger

read the source.

script/server loads the Rails environment boot file:
  require File.dirname(__FILE__) + '/../config/boot'

then requires a file from the Rails gem:
  require 'commands/server'

locate your rails gem install and read server.rb, should be in
  ruby/lib/gems/1.8/gems/rails-x.x.x/lib/commands/server.rb


On Nov 12, 1:02 pm, mahmoud_cs [EMAIL PROTECTED] wrote:
 how ruby script/server exactly work in rails?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Link to mysql.sock deleted at reboot

2008-11-12 Thread Norm

Pål Bergström wrote:
 I'm on Mac OS 10.5. How do I get a link from /tmp/mysql.sock  to
 /opt/.../mysql.sock to stay after reboot?

 Is there a better way of doing this, like adding an alias in .profile if
 possible, or is it assumed that you never reboot your machine? :-)
   
This might do what you want with the values you want in it:

#   recipe 25 from rails recipes
#
# dynamicly configure the database
#
  socket: %= [/tmp/mysqld.sock,
   /tmp/msql.sock,
   /var/run/mysqld/mysqld.sock,
   /var/run/mysqld/mysql.sock].detect{|socket|
 File.exist?(socket)
   } %



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



[Rails] Re: Help! getting a can't dup NilClass error and don't know what to do about it.

2008-11-12 Thread Frederick Cheung


On 12 Nov 2008, at 09:56, eriwright wrote:



Thanks for any help you can offer.

I am trying to send out a small batch of emails using an http
request.  I know it sounds odd. hear me out.

I have loaded a bunch of emails into this table and just want to
slowly work through them.  Sort of a poor mans AR:Mailer.  But I am
getting a can't dup NilClass when I hit it with a http request.


What's the stack trace ?

Fred



**
def message
 @reminders = Reminder.find(:all, :order = created_at DESC, :limit
= 5)
   for reminder in @reminders
  ReminderMailer.deliver_reminder_message(reminder)
  reminder.destroy
end
 render :nothing = true, :status = 401 # Unauhorized
end


I believe the Mailer class is working right.  Although when I remove
the ReminderMailer line the rest of the method works fine.

Please help if I am a million miles off on this and have some
fundamental misunderstanding.  Please, please take the time to tell  
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---





smime.p7s
Description: S/MIME cryptographic signature


[Rails] Re: images / stylesheets not loading

2008-11-12 Thread Marli Ba

Philip Hallstrom wrote:
 On Nov 11, 2008, at 12:08 PM, Marli Ba wrote:
 
 -log/development.rb-
 ---
  % end %


 I really am lost over what i need to do to fix this.  Any ideas?  It
 looks like it's now treating the image_tag as a url request somehow  
 and
 sending it into my catchall unknown_request route.
 
 I realize this might be obvious, but does RAILS_ROOT/public/bpc/images/
 products/107-440.png exist in the filesystem?

Yes, I did check that.  I wish that was the problem.  I think I'm 
getting closer to figuring it out though, I think it might have 
something to do with my dispatch.fcgi file.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Single-table inheritance: Uninitialized class constant

2008-11-12 Thread Fritz Anderson

Frederick Cheung wrote:
 use require_dependency instead of require (and i would do this at the
 top of the location model, not in the controller)

This was exactly what I needed. Thank you.

It's too bad that Pickaxe (2nd ed) and Agile Web Development with Rails 
(2nd ed) didn't mention require_dependency. Can anyone recommend a 
reference that would have included it?

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

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



[Rails] Re: InvalidAuthenticityToken error only in IE

2008-11-12 Thread Sam Kong

Mike wrote:
 Hi,
 i've got the same problem. i cant find any fix for it neither can i
 reproduce it. it just sometimes works.
 Mike

Thanks for the reply.

I couldn't fix it.
I just disabled forgery protection. :-(

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



[Rails] How to get the list of installed plugins?

2008-11-12 Thread Jej


Hi all,

Is there a simple way to get a list of installed plugins in an app? I
need name and version of each running plugin. I saw some methods in
the API, but related to the loading of plugins.

Thanks,
Jej

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



[Rails] how ruby script/server work

2008-11-12 Thread mahmoud_cs

how ruby script/server exactly work in rails?

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



[Rails] Re: Optimistic Locking and counters

2008-11-12 Thread Mattias Bud

Yes it does.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Unique key in logs to group all log entries for a single request

2008-11-12 Thread Fredrik

Does anyone know of a way to append a unique key to each request in
the logs (all lines for a single request) so they can be grouped and
viewed per request.

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



[Rails] Re: BDD with webrat and Cucumber

2008-11-12 Thread Fredrik

Not sure if it is related, but with 2.2.0RC i had much better luck
removing rspec and rspec_on_rails from the vendors folder and use the
gems. I'm using these:
rspec (1.1.11)
rspec-rails (1.1.11)

GL

On Nov 12, 1:20 pm, James Byrne [EMAIL PROTECTED]
wrote:
 OS = CentOS-5.2
 Ruby 1.8.6
 Rails 2.2.0RC1
 Cucumber 0.1.9
 Webrat 0.3.2

 I have asked about this on the RSpec list but I am repeating my request
 here to reach a somewhat wider audience.

 I am running a cucumber feature test that invokes webrat.  The step is
 defined as follows:

 Given /I am on the new entity page/ do
   visits /entities/new
 end

 # rake features then generates the following error:

   Scenario: Register a new entity                                      #
 features/manage_entities.feature:7
     Given I am on the new entity page                                  #
 features/steps/entity_steps.rb:1
       wrong number of arguments (3 for 1) (ActionView::TemplateError)
       On line #10 of app/views/entities/new.html.erb

       7: % form_for(@entity) do |f| %
       8:
       9:   %= render  :partial  = 'entities/entity_header',
       10:               :object   = @entity -%
       11:
       12:   p
       13:   %= f.submit Create -%

       
 vendor/plugins/rspec-rails/lib/spec/rails/extensions/action_view/base.rb:13:in
 `render_partial'

 This code actually works without error but I infer that I am tripping
 over some assumptions that webrat makes about views.  Is what I have
 done wrong obvious to anyone here?

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



[Rails] Re: Where to put custmized files in Rails app?

2008-11-12 Thread [EMAIL PROTECTED]

Thank you, jemminger.

That works for me now. However, I've got another issue. I have an
my_parse.rb file to parse an xml file. The directory for these files
is lib/myfiles/my_parse.rb, and lib/myfiles/xml/aa.xml. And also I
have a test file in test/unit/my_parse_test.rb. The error message is:
Errno::ENOENT: No such file or directory - xml/aa.xml when I put the
path to the aa.xml flie like this - xml/aa.xml in my_parse_test.rb.
But, it is OK if the aa.xml is in the same dir as my_parse.rb is with
the path - aa.xml.
So, what is the right path to the aa.xml in my_parse.rb if I put
aa.xml file in xml/aa.xml?
(like this: lib/myfiles/my_parse.rb, and lib/myfiles/xml/aa.xml)



On Nov 12, 2:55 pm, jemminger [EMAIL PROTECTED] wrote:
 you can have as many subdirectories in lib or anywhere else you want.
 you will just have to explicitly require those files or write
 something to auto-require the files in those dirs.

 e.g. if you make lib/myfiles/foo.rb, you'll have to put require
 'myfiles/foo.rb' to use it

 On Nov 12, 1:41 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
 wrote:



  I may not want to have a directory of files anywhere that much but,
  what if I want to separate my *rb files from *xml files? The case I am
  having now is that I have to put all my own files in a signal lib
  directory which I may not like it very much. Is this ture that I
  cannot have a sub directory in lib?

  On Nov 12, 8:13 am, jemminger [EMAIL PROTECTED] wrote:

   The lib directory is included by rails automatically, so any file in
   there will be included.  If you put it elsewhere you'll have to
   specifically require them yourself.

   On Nov 11, 11:52 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
   wrote:

Thank you for the response.

I am practicing on v1.7 and it works fine. But, if I move the code
from components to comp dir in lib, the controller can not fine those
fine any more. If I put those files in lib directly, it woks fine
again. How can I maintain a structure of directories in Rails?

Thanks,

-

On Nov 11, 4:15 pm, jemminger [EMAIL PROTECTED] wrote:

 the components dir is deprecated and removed in v2.0+ AFAIK

 you'd be better off using the lib dir or making a plugin.

 On Nov 11, 1:35 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
 wrote:

  All,

  This is the first time to play on Rails application. Simple 
  questions:
  where to locate/store my own *.rb, and *.txt files in my Rails app?
  I put my *.rb in the components folder so that controllers can see
  them without problems. Is this the right place to do that?
  But I may not know where to put *.txt files and how to locate them 
  in
  controllers.

  Thank you in advance.
  -- Hide quoted text -

 - Show quoted text -- Hide quoted text -

   - Show quoted text -- Hide quoted text -

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



[Rails] Re: Using Active Resource in ROR Application

2008-11-12 Thread Fredrik

Ryan does a great job as usual:
http://railscasts.com/episodes/94
http://railscasts.com/episodes/95

On Nov 12, 5:34 am, Shripad [EMAIL PROTECTED] wrote:
 Hi all,

 I want to use Active Resource to communicate with other application.
 How can i use Active Resource in my ROR application.
 anyone knows please help me out.

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



[Rails] Re: BDD with webrat and Cucumber

2008-11-12 Thread James Byrne

Fredrik wrote:
 Not sure if it is related, but with 2.2.0RC i had much better luck
 removing rspec and rspec_on_rails from the vendors folder and use the
 gems. I'm using these:
 rspec (1.1.11)
 rspec-rails (1.1.11)
 
 GL
 
 On Nov 12, 1:20�pm, James Byrne [EMAIL PROTECTED]

BINGO!

You know. I thought that I did that, removed both of them yesterday, and 
yet today I find that they are still there.  I must have only removed 
them as submodules from git.  But actually getting rid of them cleared 
up the problem for me.  Now I just have regularly failing tests... 
Yea I think ;-
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Custom Timezone without DST

2008-11-12 Thread Dante Regis
Hey guys
I'm having a few problems with the new TimeZone feature of Rails 2.1. Turns
out that I am on Brasilia TimeZone, (UTC - 03:00), BUT my state is NOT on
the daylight saving time. And there is no other timezone for my country with
this offset from UTC (-3:00) and that does not use DST. So, I would like to
do one of these two things:

1) Create a custom time zone

OR

2) Change Brasilia TimeZone to, on this specific app, not use the DST.

Is any of these options possible? Is there any other solution for the matter
(like :use_dst = false, or something like that?)

Thanks,
Dante Regis

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



[Rails] Re: help with JQuery

2008-11-12 Thread Mark Thomas



On Nov 12, 10:48 am, César [EMAIL PROTECTED] wrote:
 Hi,
    have somebody experience using JQuery in an application Ror join to
 prototype?
    somebody knows if is possible use Prototype and JQuery all together?

    I am trying implement drag and drop effects in a table but nothing
 is happening.

Do you really need both prototype and JQuery? In general, if you can
keep it all in one JS framework your app will be easier to build and
maintain.

You can do drag-and-drop with Prototype and Scriptaculous. DevArticles
has an excerpt from the book Ajax on Rails which explains drag-and-
drop: 
http://www.devarticles.com/c/a/Ruby-on-Rails/Drag-and-Drop-with-scriptaculous-and-Rails/

If for some reason you must have only the JQuery version of drag-and-
drop, you may want to investigate using JRails (http://ennerchi.com/
projects/jrails) so that the rest of your Rails helpers are
implemented in JQuery, and then you don't need prototype.

Lastly, if it turns out that you absolutely have to have both
libraries, there is a no-conflict mode in JQuery that makes it
possible. Out of the box, prototype and JQuery don't work together
because they both define the $() function. If you call
jQuery.noConflict(), then you can use jQuery() instead of $(). Note
that this means you'll have to translate any jQuery code you copy from
other sources. More details here: 
http://docs.jquery.com/Using_jQuery_with_Other_Libraries

-- Mark.



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



[Rails] Re: Run 1.2.6 rails application on 2.0.2 rails

2008-11-12 Thread Fredrik

I believe there is more errors above what you posted. Could please add
that?

Could it be that you upgraded soap4r and it is not compatible with the
code in you 1.2.6 app?

If that is the case and you did not run gem cleanup, you could try
uninstalling the latest version of soap4r if there are two present
when you run
$ gem list
otherwise
$ gem uninstall soap4r
$ gem install soap4r -v Version you had before

As long as your 2.0.2 version does not depend on the soap4r version
currently installed, you should be ok.

As you move on to more recent (not that they are old) versions you
will have the option of specifying gem dependencies for your projects.

On Nov 12, 3:33 am, Brijesh Shah [EMAIL PROTECTED]
wrote:
 Hi All,

 Currently I have two types of project.
 one is made in 1.2.6 and another in 2.0.2
 I upgraded gems and all that. Rails 2.0.2 application are running
 perfectly but 1.2.6 is not.

  from /usr/lib/ruby/gems/1.8/gems/soap4r-1.5.8/lib/soap/ns.rb:18
         from
 /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
 `gem_original_require'
         from
 /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
         from
 /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in
 `require'
         from
 /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in
 `new_constants_in'
         from
 /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in
 `require'
         from
 /usr/lib/ruby/gems/1.8/gems/soap4r-1.5.8/lib/soap/generator.rb:10
         from
 /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
 `gem_original_require'
          ... 73 levels...
         from
 /usr/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/commands/server.rb:39
         from
 /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
 `gem_original_require'
         from
 /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
         from script/server:3

 This kind of error is there...
 So can anyone tell me how can I run both kind of application on same
 system.
 --
 Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Some optimization hacks: your opinion?

2008-11-12 Thread reHa

Some questions about disabling GC:

* Memory consuming action - will it kill server?

* Very small (not memory consuming) action - won't GC.start slow it
down significantly? (it's called every time)

* Lets assume that one of your libraries used by the action is calling
GC.start explicitly - the library knows it consumes a lot of memory
and tries to free it in the right time - what will happen?


These are just some random questions about bad scenarios.


On Nov 12, 6:02 pm, Enrico Thierbach
[EMAIL PROTECTED] wrote:
 Hi everyone,

 I found and tried two optimization hacks; however, I don't feel too
 comfortable with them. Therefore I would appreciate your opinion:

 - Caching proc objects, i.e.

   class Symbol
     def to_proc
       @to_proc ||= Proc.new { |*args| args.shift.__send__(self, *args) }
     end
   end

 - and disabling the GC during an action:

   around_filter do |controller, action|
     GC.disable
     begin
       action.call
     ensure
       GC.enable
       GC.start
     end
   end

 On some of our machines and with some requests they boost performance
 by as much as 50%. however, as I don't know if I shuld feel ssave with
 them I would like to hear your opinions.

 BTW: A longer version of this text, with some explanation, is 
 here:http://1rad.wordpress.com/2008/11/10/0x0a-some-optimization-hacks/

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



[Rails] Multiple views with same controller

2008-11-12 Thread Mario Peterscheck

Hi there,

I want to truncate all the data from user model being edited in
different tabs (e.g. privacy data like newsletter receiving, login data,
user data, etc.), being convinient for the user.

First I wrote a controller for each section editing the same model. I
just don't think it's the best way, that's why I discarted it.

I'm taking care about the RESTfull resources, so of course, right now
it's called %= link_to 'Edit member profile',
edit_user_path(logged_in_user) %.

I have about 30 information to edit in the user model and want to let
thm edit separately. How do you do that? Any experience, any
suggestions?

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

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



[Rails] Re: Where to put custmized files in Rails app?

2008-11-12 Thread jemminger

The lib directory is included by rails automatically, so any file in
there will be included.  If you put it elsewhere you'll have to
specifically require them yourself.

On Nov 11, 11:52 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
 Thank you for the response.

 I am practicing on v1.7 and it works fine. But, if I move the code
 from components to comp dir in lib, the controller can not fine those
 fine any more. If I put those files in lib directly, it woks fine
 again. How can I maintain a structure of directories in Rails?

 Thanks,

 -

 On Nov 11, 4:15 pm, jemminger [EMAIL PROTECTED] wrote:

  the components dir is deprecated and removed in v2.0+ AFAIK

  you'd be better off using the lib dir or making a plugin.

  On Nov 11, 1:35 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
  wrote:

   All,

   This is the first time to play on Rails application. Simple questions:
   where to locate/store my own *.rb, and *.txt files in my Rails app?
   I put my *.rb in the components folder so that controllers can see
   them without problems. Is this the right place to do that?
   But I may not know where to put *.txt files and how to locate them in
   controllers.

   Thank you in advance.
   -- Hide quoted text -

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



[Rails] dynamic condition for has_one and eager loading issue

2008-11-12 Thread [EMAIL PROTECTED]

Hi,

I ve defined the following relation in one of my models with a dynamic
where condition:
has_one :selection,
  :foreign_key = 'object_id',
  :conditions = 'selection_type = 1 and account_id = #
{self.send(:account_id)}'

That works perfect, however when I try to eager load that relation I
am getting the following error when doing a count. Seems that self is
not really my model class anymore Does anybody know how I can get
that up and running?

Thanks a lot in advance

NoMethodError (undefined method `account_id' for
#ActiveRecord::Associations::ClassMethods::JoinDependency::JoinAssociation:
0x4d5bf5c):
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/associations.rb:1621:in `interpolate_sql'
(eval):1:in `interpolate_sql'
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/associations.rb:1600:in `association_join'
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/associations.rb:1599:in `each'
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/associations.rb:1599:in `association_join'
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/calculations.rb:184:in `construct_calculation_sql'
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/calculations.rb:184:in `collect'
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/calculations.rb:184:in `construct_calculation_sql'
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/calculations.rb:212:in `execute_simple_calculation'
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/calculations.rb:121:in `calculate'
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/calculations.rb:117:in `catch'
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/calculations.rb:117:in `calculate'
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/calculations.rb:45:in `count'




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



[Rails] Re: Files with .fs extension in ruby on rails application

2008-11-12 Thread jemminger

http://filext.com/file-extension/FS


On Nov 12, 9:44 am, Raul Mosquera [EMAIL PROTECTED]
wrote:
 I am using Spiceworks, an application made with Ruby on Rails. It has
 some files with .fs extension but i don´t know what are this files and
 with wich tools are generated. ¿Could someone say me something about it?

 I attached one of this files.

 Thank you.

 Attachments:http://www.ruby-forum.com/attachment/2923/spiceworks.fs

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



[Rails] Re: dynamic condition for has_one and eager loading issue

2008-11-12 Thread Frederick Cheung



On Nov 12, 7:32 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Hi,

 I ve defined the following relation in one of my models with a dynamic
 where condition:
 has_one :selection,
           :foreign_key = 'object_id',
           :conditions = 'selection_type = 1 and account_id = #
 {self.send(:account_id)}'

 That works perfect, however when I try to eager load that relation I
 am getting the following error when doing a count. Seems that self is
 not really my model class anymore Does anybody know how I can get
 that up and running?

When you do a 'normal' load the conditions are interpolated in the
context of the appropriate instance, but when you do an eager load
that can't happen (because the object is not loaded yet (so account_id
is not known) or because you are loading multiple record) so the
conditions are evaluated in the context of the class. You just can't
eager load stuff with that sort of interpolated condition, although I
suppose you might be able to put together a separate association,
purely for eager loading, where the conditions would become account_id
= parent_objects.account_id.

Fred
 Thanks a lot in advance

 NoMethodError (undefined method `account_id' for
 #ActiveRecord::Associations::ClassMethods::JoinDependency::JoinAssociation :
 0x4d5bf5c):
     C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
 active_record/associations.rb:1621:in `interpolate_sql'
     (eval):1:in `interpolate_sql'
     C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
 active_record/associations.rb:1600:in `association_join'
     C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
 active_record/associations.rb:1599:in `each'
     C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
 active_record/associations.rb:1599:in `association_join'
     C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
 active_record/calculations.rb:184:in `construct_calculation_sql'
     C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
 active_record/calculations.rb:184:in `collect'
     C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
 active_record/calculations.rb:184:in `construct_calculation_sql'
     C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
 active_record/calculations.rb:212:in `execute_simple_calculation'
     C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
 active_record/calculations.rb:121:in `calculate'
     C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
 active_record/calculations.rb:117:in `catch'
     C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
 active_record/calculations.rb:117:in `calculate'
     C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
 active_record/calculations.rb:45:in `count'
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Can't create has_one record

2008-11-12 Thread T. B.

Hello all. I have the following code in my Accounts controller:

@account = Account.create(params[:account])
@website = @account.websites.create(params[:website])
@contact = @account.contact.create(params[:contact])

My Account model has_one :contact and my Contact belongs_to :account,
yet I get the following error:

NoMethodError: You have a nil object when you didn't expect it!
The error occurred while evaluating nil.create


- - - - - -


I've scoured the documentation and can't find where I'm mucking things
up. Any help is greatly appreciated!

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

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



[Rails] Sharing view between new and edit actions

2008-11-12 Thread Sam Kong

Hi,

I had an argument with the web designer about a philosophical(not very
practical) issue.

Normally, we have new.html.erb and edit.html.erb and they share
_form.html.erb as a partial render.
The designer said that there should be only one view template and use
if-statement for minor differences.

For example, they all should be combined into form.html.erb.
She thinks that it's better design-wise.
No redundancy, blah blah...

I am against it.
But I failed to convince her.

What do you think?

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



[Rails] [ANN] First Cincinnati.rb Meeting

2008-11-12 Thread Michael Guterl

If you live in or near Cincinnati, love Ruby and want to get together to
talk and do some hacking, please join us.

Date:  Every Tuesday (Except the 1st Tuesday of the month, in deference
to the excellent Agile Round Table meetings)
Time:  6:30pm
Place: RecruitMilitary HQ, 422 W. Loveland Ave. Loveland, OH 45140

More information at http://cincinnatirb.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How to get hash values????

2008-11-12 Thread Smarty 2k


Solved... Thank you Very much


Rui Neto wrote:
 @totalemail[0][:email]  does the trick ?
 
 Cheers.
 
 [ rui ]
 [ Seiri, Seiton, Seisō, Seiketsu e Shitsuke ]
 
 
 
 On Wed, Nov 12, 2008 at 9:04 AM, Smarty 2k

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

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



[Rails] Re: Nested forms with multiple models

2008-11-12 Thread jemminger

one suggestion:  don't put business logic in your views.  replace
FlightTime.new with @flight_time and let your controller figure
out if it should be a new or existing record.


On Nov 12, 7:32 am, Alex Jonsson [EMAIL PROTECTED] wrote:
 Hey guys, I need your help again!

 I have a form in which I want to nest multiple models. Kind of like a
 project has many tasks but rather a flight has one flight time per
 flight type.

 So it's three models - Flight, FlightType and FlightTime. Flight -
 FlightTime - FlightType

 What I want to do is to loop through the FlightTypes in the add/edit
 Flight form, and present a text box whose value then will be stored
 as :hours in a FlightTime along with a :flight_id and :flight_type_id
 value. I hope I've made myself clear.

 This is the code I have in my flight_form view currently:

 http://pastie.org/312947

 Now this works perfectly when _adding_ FlightTimes as I'm using a
 FlightTime.new, but the issue I have is that I also want to be able to
 edit the values. When I try to use this form for editing, all the
 values in the boxes are emptied and anything I put in them are added
 as new FlightTimes (obviously). There can only be one FlightTime per
 FlightType per Flight, so to speak.

 So, anyone up for the task to help me out?

 Thanks,
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



  1   2   >