[Rails] Re: has_and_belongs_to_many relationship in nested forms

2009-03-25 Thread Josh Moore
Hi,  After I looked into it some more I figured it out.  I had a little bit
of a concept mix up with accepts_nested_attributes_for.  Because I do not
want to create nested record.  I do not think it is appropriate for this
situation.  So I do not use it anymore.  Thanks for the help sorry to cause
people trouble.

Josh


On Thu, Mar 26, 2009 at 10:00 AM, Josh Moore  wrote:

> Here is the code.  I am sorry because this is work I cannot post the entire
> application.  Thanks for all help and I hope this makes my problem clearer.
>
> Thanks,
>
> Josh
>
>
> class StressTest < ActiveRecord::Base
>   has_and_belongs_to_many :tst_definitions
>   accepts_nested_attributes_for :tst_definitions
>   has_many :tst_datas
> end
>
>
> class StressTestsController < ApplicationController
>   layout 'tests.html'
>   def index
> @stress_tests = StressTest.all
>   end
>
>   def new
> @stress_test = StressTest.new
>
> #want to add not create new tst_definitions
> @stress_test.tst_definitions<< TstDefinition.first
>   end
>
>   def create
> @stress_test = StressTest.new(params[:stress_test])
> logger.info params.to_yaml
> if @stress_test.save
>   flash[:notice] = "Successfully create Stress Test: #{@
> stress_test.name}"
>   redirect_to :action => 'index'
> else
>   render :action => 'new'
> end
>   end
>
>   def destroy
> @stress_test = StressTest.find(params[:id])
> @stress_test.destroy
> redirect_to :action => 'index'
>   end
> end
>
>
>
> The new form
> New Stress Test
> 
>
> <% form_for(@stress_test) do |f| %>
>   
> 
>   <%= f.label :name %><%= f.text_field :name %>
> 
> 
>   <%= f.label :max_concurrent_scans %><%= f.text_field
> :max_concurrent_scans %>
> 
> 
>   <%= f.label :number_of_runs %><%= f.text_field
> :number_of_runs %>
> 
>   
>
>   <% f.fields_for :tst_definitions do |test_form| %>
> 
>   <%= test_form.select :name, TstDefinition.find_by_sql("select id,
> name from tst_definitions").collect {|test| [test.name, test.id]} %> <%=
> link_to 'Remove', '#remove_project', :class => 'remove_codesecure_project'
> %>
> 
> <%= link_to 'Add a project', '#add_project', :class =>
> 'add_codesecure_project' %>
>   <% end -%>
>
>   
>   <%= f.submit 'submit' %>
>
> <% end -%>
>
> Javascript that addess a new drop down so that multiple tst_definitions can
> be added to a single stress_test
> $(document).ready(function() {
>   $("a[class=\"add_codesecure_project\"]").click(function(event){
> var copy_object = $("ul").children().eq(0).clone()
> copy_object.appendTo("ul");
> var num_of_children = $("ul").children().size();
> copy_object.children("select").attr("id",
> copy_object.children("select").attr("id").replace(/0/, (num_of_children -
> 1)));
> copy_object.children("select").attr("name",
> copy_object.children("select").attr("name").replace(/0/, (num_of_children -
> 1)));
> //alert(copy_object.children("select").attr("id").replace(/0/,
> (num_of_children - 1)));
>
> //alert(copy_object.children("select").attr("id"))
> //alert(copy_object.attr("id"));
>
> add_remove_link();
>   });
>
> });
>
>
>
> On Wed, Mar 25, 2009 at 11:28 PM, Greg Donald  wrote:
>
>>
>> On Wed, Mar 25, 2009 at 2:38 AM, Josh Moore  wrote:
>> > Hi,
>> >
>> > I have two models (say model a and b) that are joined using the
>> > has_and_belongs_to_many association.  In model A I want to be able to
>> link
>> > to model B in a form.  But, when I create a nested_form for model B I
>> have a
>> > problem.  Instead of linking to the exciting records in Model B.  It
>> creates
>> > new ones.  Is there anyway to use nested_forms so that model B objects
>> are
>> > linked to, but not created on submission?  When I create a new model A I
>> > just want to link to, not create new model Bs.  Is this possible?
>>
>> Yes, and it's likely someone could help debug the issue if you post the
>> code.
>>
>>
>>
>> --
>> Greg Donald
>> http://destiney.com/
>>
>> >>
>>
>

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



[Rails] send_file using AJAX

2009-03-25 Thread Sudhi Kulkarni

I have a AJAX based form and when I use send_file there is no pop-up
that appears to prompt user to download file... how do I fix this?

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

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



[Rails] Re: unknown action - incorrect route

2009-03-25 Thread Jason Lillywhite

> map.resources :events


OK. I'm still learning about RESTful. I'll study up on that. Thank you!
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: nil.errors and error_messages_for

2009-03-25 Thread Phlip

> Here we go:
> 
> @discount = Discount.find(params[:id])
> if @discount.update_attributes(params[:discount])
>   flash[:notice_good] = "Discounts have been updated"
>   redirect_to :action=> 'index'
> else
>   index # I need to do this in order to get my instance variables
> populated for the index view

and ... index re-populates @discount?

put this inside the index:

   @discount ||= Discount.new

>   render :action => 'index'
> end


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



[Rails] Re: ActionMailer Layout on HTML version not Plain Text

2009-03-25 Thread Danimal

BTW, looks like this has been a known bug for a little while:
https://rails.lighthouseapp.com/projects/8994/tickets/1799-actionmailer-doesnt-set-template_format-when-rendering-layouts

(since January at least).

*sigh*

Hopefully someone will fix it. If I knew the internals of Rails
better, I'd give it a go myself.

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



[Rails] Re: nil.errors and error_messages_for

2009-03-25 Thread bongoman

 > So... uh... @discount indeed contains a stuffed Discount instance
with populated
> errors... so what's the problem??

Well it only does when the index template is rendered AFTER validation
fails. The same action gets invoked prior to the form submission at
which point in time there is no @discount variable, hence the
nil.errors

> So post your actual action instead of making us guess? (-8

Here we go:

@discount = Discount.find(params[:id])
if @discount.update_attributes(params[:discount])
  flash[:notice_good] = "Discounts have been updated"
  redirect_to :action=> 'index'
else
  index # I need to do this in order to get my instance variables
populated for the index view
  render :action => 'index'
end

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



[Rails] Re: ActionMailer Layout on HTML version not Plain Text

2009-03-25 Thread Danimal

Hi!

I just posted the exact same issue here before I saw this thread. It
doesn't work for me on Rails 2.2.2.

I was really excited to see layouts in ActionMailer, but this is
frustrating. *sigh*

-Danimal

(I'm poking around in the ActionMailer code to see if there is
anything I can find)

On Mar 17, 3:53 am, Iain Adams  wrote:
> Did you ever find an answer to this? I have the exact same problem.
>
> http://guides.rubyonrails.org/action_mailer_basics.html
>
> claims you can use different content types (plain/html) but it doesn't
> work for me
>
> On Mar 10, 11:25 am, Raymond O'Connor 
> s.net> wrote:
> > Is there really no way to do this?  This pretty much makes actionmailer
> > layouts useless if you are sending html emails with plain text
> > alternatives.
>
> > --
> > Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: nil.errors and error_messages_for

2009-03-25 Thread Phlip

bongoman wrote:

> I'm wanting to re-render my index action in the event of an object not
> getting saved; I use render not redirect so as to preserve the
> validation errors.
> 
> I'm using the error_messages_for helper in my view but I get a
> nil.errors error when I attempt to display the view.
> 
> I can avoid this error by setting up @discount = Discount.new in my
> index action, but this obliterates the instance variable with the
> attached error messages.
> 
> I'm chasing my tail on this and any clues would be appreciated.

Hear galloping think horses not zebras, here...

Your action goes like...

  @discount = Discount.new(params[:discount]) # warning use attr_protected!
  unless @discount.save
render :action => 'index'
  end

So... uh... @discount indeed contains a stuffed Discount instance with 
populated 
errors... so what's the problem??

So post your actual action instead of making us guess? (-8


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



[Rails] Turning off the layout in ActionMailer?

2009-03-25 Thread Danimal

So I'm happy to see that ActionMailer supports layouts now (it may
have for a while, but I just now realized it).

But I don't see a way to turn them off selectively or by multipart
type.

For example, if I have a layout that's really simple in "layouts/
email.html.erb":


  <%= yield %>


I can then use that in my ActionMailer class with a line at the top:
layout 'email'

But when I use multipart and have an HTML and a PLAIN file, they both
use the layout and thus the plain contains the  tag.

Is there any way to avoid this? or turn it off in certain cases?

Thanks,

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



[Rails] nil.errors and error_messages_for

2009-03-25 Thread bongoman

Hi there

I'm wanting to re-render my index action in the event of an object not
getting saved; I use render not redirect so as to preserve the
validation errors.

I'm using the error_messages_for helper in my view but I get a
nil.errors error when I attempt to display the view.

I can avoid this error by setting up @discount = Discount.new in my
index action, but this obliterates the instance variable with the
attached error messages.

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



[Rails] Deleting files after they are sent via send_file

2009-03-25 Thread elioncho

Hello guys,

I am having the option to download certain folders on my app in zip
format. So every time a user requests one I'm doing a system call to
zip the folder (ex: system('cd '+path+' && zip ...) and then the
send_file method to send it.

What happens is that I'm keeping track of disk space so I need to
delete the zip immediately. I was wondering if there is a way of
creating the zip file in a sort of tmp directory and send it via
send_file from the tmp path. I don't know when the file transfer is
over to delete the zip file and having a cron job to delete zip files
is not an option (disk space could be surpassed by the zip file and
the user will have to wait for it to be deleted to be able to create
new files). Can anyone point me in the right direction please. Thanks,

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



[Rails] Re: Using same variable in controller

2009-03-25 Thread Conrad Taylor

Sent from my iPhone

On Mar 25, 2009, at 7:53 PM, Power One  wrote:

>
> Hi guys!  More question :P~
>
> OK, I'm following a tutorial for rail, and I got this new.html.erb in
> views, and in order for a form to be showed up correctly without  
> error,
> I had to add this small snippet of code in the controller under method
> "def new".
>
> class AdsController < ApplicationController
>  2   def show
>  3 @ad = Ad.find(params[:id])
>  4   end
>  5
>  6   def index
>  7 @ads = Ad.find(:all)
>  8   end
>  9
> 10   def new
> 11 @ad = Ad.new
> 12   end
> 13 end
>
> My question is, I thought this would be creating an error because I  
> have
> def show using variable @ad, and then def new also using variable @ad,
> but instead of any glitch, I got the rail app works out perfectly.
>
> I'm new to ruby and the programming world and especially rail.  I just
> wonder is this a good practice?  It's like overwrite what @ad in "def
> show" when user wants to get action "def new."  Or maybe I got  
> confused?
> Rails has all variable in each method as local?  Or each time each
> action/method gets executed, it will be newly object in memory anyway,
> and so it won't be affected by the code/abstract above?  Please help  
> me
> understand this, thanks...
> -- 
> Posted via http://www.ruby-forum.com

Andreas, the instance variable is set when the action is invoked.  For  
example,

http://www.example.com/controller/action

Thus, I would recommend reading one of the relevant guides at

guides.rubyonrails.org

Good luck,

-Conrad

>
> >

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



[Rails] Version fu problem

2009-03-25 Thread Freddy Andersen

Hi,

I have a class that uses version_fu (Page class) the issue is that if
I run a clean migration it fails on the version_fu declaration in the
Page class, Its looking for the page_versions column that has not been
created yet.

Anyone seen this before?

Looks like if I do

version_fu rescue nil

The error does not show and my migration runs all the way to the
end... isn't that just ugly?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Using same variable in controller

2009-03-25 Thread Phlip

Power One wrote:

> My question is, I thought this would be creating an error because I have
> def show using variable @ad, and then def new also using variable @ad,
> but instead of any glitch, I got the rail app works out perfectly.

Welcome to "event driven" land.

If you wrote a new class, and did not inherit ApplicationController, you would 
create class instances with .new.

x = MyClass.new

Instance variables - beginning with @ - would live as long as x did.

A Controller class is different. Rails creates an instance for you, each time 
the routes.rb map tells Rails to. Then this object lives long enough to service 
one and only one action.

Then it dies. All its instance variables go away, too.

So you can declare different sets of instance variables - or even the same set 
- 
in each action, and Rails generally keeps them out of each others' hair.

Now please read a book on Ruby, straight thru. Typing in tutorials is fun, but 
it burdens this newsgroup with content that you should be learning for yourself!

-- 
   Phlip


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



[Rails] Using same variable in controller

2009-03-25 Thread Power One

Hi guys!  More question :P~

OK, I'm following a tutorial for rail, and I got this new.html.erb in
views, and in order for a form to be showed up correctly without error,
I had to add this small snippet of code in the controller under method
"def new".

 class AdsController < ApplicationController
  2   def show
  3 @ad = Ad.find(params[:id])
  4   end
  5
  6   def index
  7 @ads = Ad.find(:all)
  8   end
  9
 10   def new
 11 @ad = Ad.new
 12   end
 13 end

My question is, I thought this would be creating an error because I have
def show using variable @ad, and then def new also using variable @ad,
but instead of any glitch, I got the rail app works out perfectly.

I'm new to ruby and the programming world and especially rail.  I just
wonder is this a good practice?  It's like overwrite what @ad in "def
show" when user wants to get action "def new."  Or maybe I got confused?
Rails has all variable in each method as local?  Or each time each
action/method gets executed, it will be newly object in memory anyway,
and so it won't be affected by the code/abstract above?  Please help me
understand this, thanks...
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Sending & Recieving Mail

2009-03-25 Thread Richard Schneeman

Strange, i was abandoning the idea altogether, but went back changed my 
code to give you the output you asked for, and poof...it worked. No clue 
what changed. Thanks for your help or i may have never tried again. So 
it turns out that you can send email from the recieve(email) method of 
your mailer after all.

But for some reason both ways of sending email end up sending multiple 
emails instead of just one: 
http://www.ruby-forum.com/topic/182526#798332 ... Any clue why?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] ActionMailer Sends Multiple Messages

2009-03-25 Thread Richard Schneeman

When i use "MyMailer.deliver_reply()" in my console, I send an email
exactly as i would expect, but when i call "MyMailer.deliver_reply()"
inside of my receive method, my app sends multiple duplicate messages,
Do you have any clue what may be causing this behavior?

Here is a copy of my log file http://pastie.org/427306.

Here is some pseudo code of what my mailer looks like:

class MyMailer < ActionMailer::Base
def receive(email)
# code to store email information
MyMailer.deliver_reply(email_address_of_sendee)
end

def reply(to_email)
   # code to send email, works great when called through console
end
end



This mailer takes in an email stores it, and then thanks the sender for
sending something automatically
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Passenger vs Mongrel

2009-03-25 Thread Power One

Thanks for the suggestion.  Last night I got passenger gem installed, 
and then I point apache's document root to my-app/public/, but for some 
reason, passenger couldn't find the app.  Oh, it find the public/'s 
static index page OK, but when I entered direct url such as 
my-app/display, the server displayed some sort of page not found.  I 
know for sure my route is OK, because if I test it with mongrel by doing 
/script/server, and visit localhost:3000, it would work.  To be clear I 
got Apache running fine, because PHP's Drupal is running when I visit 
something.example.com/drupal.  (I changed /etc/hosts/ to have 
example.com works as localhost).  I know my apache's virtual hosts 
configuration got it right because I did that for PHP's Drupal.

With that said, I have to go and read more about passenger and its 
tutorial, plus how RoR/Ruby server gets deployed.

Aníbal Rojas wrote:
> Power One,
> 
>The answer is 'it depends', if you are familiar with Apache,
> already have it running and feel comfortable managing it Passenger is
> a really good option, also it should do a great job if you are
> planning to have a bunch of small apps. If you are low on resources
> and need nothing but run a rails app mongrel or thing should do the
> job for you, usually with a small, fast, efficient web server in the
> front end as Nginx.
> 
>I would recommend posting it to the Rails Deployment Group:
> 
>http://groups.google.com/group/rubyonrails-deployment/about
> 
>Best regards,
> 
> --
> An�bal Rojas@anibalrojas
> http://hasmanydevelopers.com
> http://rubycorner.com
> http://en.anibal.rojas.com.ve
> 
> On Mar 26, 4:24 am, Power One 

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

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



[Rails] How to add .patch

2009-03-25 Thread jko170

Noob question here: How do I add this patch to activemerchant?

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



[Rails] Re: Defining fixtures in Unit Tests necessary?

2009-03-25 Thread Phlip

yachtman wrote:

> Just sinking my teeth into tests and the going is tough.

Not as tough as debugging all night before a release. Stick with TDD and you 
will never look back!

> Is it necessary to define fixtures in my test file
> ('fixtures :users')?
> 
> My test are working with the definition, but I decided to debug and
> checked for the fixtures existence even without the definition and all
> of them had been loaded. So what's the purpose of the declaration?

Of course they are there - you loaded them. However, consider this test suite:

class SomeTests ...

def test_aardvark
  screw_users_table_up()
  assert{ users_table_is_screwed_up() }
end

def test_zebra
  deny{ users_table_is_screwed_up() }
end

end

The test case names force [the current version of] test/unit to run those cases 
in that order.

The second test will fail because the first one screwed the table up.

The 'fixtures :users' line means "please un-screw-up the users table between 
each test case". Adding it to my hypothetical test suite would "fix" it.

The fixture system enables "Test Isolation". You could run any test case, in 
any 
order, or not at all, and each one should not add any noise to the signal from 
any other.

-- 
   Phlip


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



[Rails] Re: has_and_belongs_to_many relationship in nested forms

2009-03-25 Thread Josh Moore
Here is the code.  I am sorry because this is work I cannot post the entire
application.  Thanks for all help and I hope this makes my problem clearer.

Thanks,

Josh


class StressTest < ActiveRecord::Base
  has_and_belongs_to_many :tst_definitions
  accepts_nested_attributes_for :tst_definitions
  has_many :tst_datas
end


class StressTestsController < ApplicationController
  layout 'tests.html'
  def index
@stress_tests = StressTest.all
  end

  def new
@stress_test = StressTest.new

#want to add not create new tst_definitions
@stress_test.tst_definitions<< TstDefinition.first
  end

  def create
@stress_test = StressTest.new(params[:stress_test])
logger.info params.to_yaml
if @stress_test.save
  flash[:notice] = "Successfully create Stress Test: #...@stress_test.name
}"
  redirect_to :action => 'index'
else
  render :action => 'new'
end
  end

  def destroy
@stress_test = StressTest.find(params[:id])
@stress_test.destroy
redirect_to :action => 'index'
  end
end



The new form
New Stress Test


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

  <%= f.label :name %><%= f.text_field :name %>


  <%= f.label :max_concurrent_scans %><%= f.text_field
:max_concurrent_scans %>


  <%= f.label :number_of_runs %><%= f.text_field
:number_of_runs %>

  

  <% f.fields_for :tst_definitions do |test_form| %>

  <%= test_form.select :name, TstDefinition.find_by_sql("select id,
name from tst_definitions").collect {|test| [test.name, test.id]} %> <%=
link_to 'Remove', '#remove_project', :class => 'remove_codesecure_project'
%>

<%= link_to 'Add a project', '#add_project', :class =>
'add_codesecure_project' %>
  <% end -%>

  
  <%= f.submit 'submit' %>

<% end -%>

Javascript that addess a new drop down so that multiple tst_definitions can
be added to a single stress_test
$(document).ready(function() {
  $("a[class=\"add_codesecure_project\"]").click(function(event){
var copy_object = $("ul").children().eq(0).clone()
copy_object.appendTo("ul");
var num_of_children = $("ul").children().size();
copy_object.children("select").attr("id",
copy_object.children("select").attr("id").replace(/0/, (num_of_children -
1)));
copy_object.children("select").attr("name",
copy_object.children("select").attr("name").replace(/0/, (num_of_children -
1)));
//alert(copy_object.children("select").attr("id").replace(/0/,
(num_of_children - 1)));

//alert(copy_object.children("select").attr("id"))
//alert(copy_object.attr("id"));

add_remove_link();
  });

});


On Wed, Mar 25, 2009 at 11:28 PM, Greg Donald  wrote:

>
> On Wed, Mar 25, 2009 at 2:38 AM, Josh Moore  wrote:
> > Hi,
> >
> > I have two models (say model a and b) that are joined using the
> > has_and_belongs_to_many association.  In model A I want to be able to
> link
> > to model B in a form.  But, when I create a nested_form for model B I
> have a
> > problem.  Instead of linking to the exciting records in Model B.  It
> creates
> > new ones.  Is there anyway to use nested_forms so that model B objects
> are
> > linked to, but not created on submission?  When I create a new model A I
> > just want to link to, not create new model Bs.  Is this possible?
>
> Yes, and it's likely someone could help debug the issue if you post the
> code.
>
>
>
> --
> Greg Donald
> http://destiney.com/
>
> >
>

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



[Rails] Re: Rails 2.2.2 - Mysql::Error: MySQL server has gone away

2009-03-25 Thread Andrew Roth

I've had some success with the mysql_retry_lost_connection gem.

On Mar 21, 5:21 pm, Andrew Roth  wrote:
> I'm getting these MySQL server has gone away on SHOW FIELDS too.  I've
> spent a fair bit of effort trying to figure out what's going on, with
> no success.  All we've determined is it seems to have a higher chance
> of happening after some idle time.  I can usually make it happen by
> hitting an ajax page with many requests at once (just spamming the
> ajax).  Any ideas welcome.
>
> On Mar 2, 10:56 pm, Adeel Ahmad 
> wrote:
>
> > My app consists of receiving emails with image attachments from its
> > users so I have been employing the MMS2R gem and Fetcher. Every 60
> > seconds the app goes to the email server to fetch emails.
>
> > Under Rails 2.1.1 things worked fine - when I received an email, the
> > email was fetched, parsed and saved to the database.
>
> > However I needed to upgrade to Rails 2.2.2 for unrelated reasons and now
> > I get the following error in my log when the app tries to save to the
> > database. Emailpic is just the model in the database.
>
> > "Emailpic Columns (0.0ms)   Mysql::Error: MySQL server has gone away:
> > SHOW FIELDS FROM `emailpics`"
>
> > Does anyone know what changed between 2.1.1 and 2.2.2 to cause this to
> > happen?
> > --
> > Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Change the Web Challenge

2009-03-25 Thread Emily Kornblut

Hi everyone -

I wanted to let you all know about Social Actions' Change the Web
Challenge, a contest for creating new web applications & widgets that
promote opportunities to take action all over the web, with cash
prizes!

1st place: $5,000
2nd place: $3,000
3rd place: $2,000

Social Actions has created an open API of over 60,000 opportunities to
make a difference from 50+ sources including Change.org, Kiva.org,
VolunteerMatch, and Idealist.org. It would be awesome if you wanted to
submit apps that draw on Social Actions' database and help people
connect to ways to take action. Interested?

* Check out the Developer Resources: http://www.socialactions.com/developers
* Join Social Actions Developers Google Group:
http://groups.google.com/group/social-actions-dev
* Check out apps already submitted: 
http://netsquared.org/projectgallery/changetheweb
* More info: http://netsquared.org/changetheweb


I hope you'll join us and whip up apps that help change the world.
Submissions close April 3rd, so get hackin' and we look forward to
seeing your entries!

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



[Rails] form_tag_with_upload_progress with rails 2.x not updating its progress bar

2009-03-25 Thread railzman

Hello guys!
I've just installed the upload_progress plugin and followed the
instructions
but the progress bar does not get updated.

When upload starts I can read "Upload starting..." just below the
empty progress bar, when the upload completes it reads "Upload
finished."
and the progress bar turns all black.

What is really strange is that I have a lot of "Processing
MyController#upload_status" in the log file.

Any idea on what might be wrong with this?

Thank you.


--
Jose

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



[Rails] Re: Starling problem

2009-03-25 Thread Freddy Andersen


You should try the later Starling-starling gem found here
http://github.com/starling/starling/tree/master

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



[Rails] Defining fixtures in Unit Tests necessary?

2009-03-25 Thread yachtman

Just sinking my teeth into tests and the going is tough.

Is it necessary to define fixtures in my test file
('fixtures :users')?

My test are working with the definition, but I decided to debug and
checked for the fixtures existence even without the definition and all
of them had been loaded. So what's the purpose of the declaration?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Starling problem

2009-03-25 Thread Florian

Hi,
installed starling on OS-X (starling (0.9.8), ruby 1.8.7 (2008-08-11
patchlevel 72)) , and am getting some weird exceptions when running it
out of the box. Has anyone seen similar problems?

Thanks,
Florian

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'starling'
=> true
irb(main):003:0> starling = Starling.new('127.0.0.1:22122')
=> 
irb(main):004:0> starling.set('my_queue', 12345)
TypeError: can't dup NilClass
from /opt/local/lib/ruby/gems/1.8/gems/starling-0.9.8/lib/starling.rb:
94:in `dup'
from /opt/local/lib/ruby/gems/1.8/gems/starling-0.9.8/lib/starling.rb:
94:in `get_server_for_key'
from /opt/local/lib/ruby/gems/1.8/gems/memcache-client-1.6.5/lib/
memcache.rb:689:in `request_setup'
from /opt/local/lib/ruby/gems/1.8/gems/memcache-client-1.6.5/lib/
memcache.rb:658:in `with_server'
from /opt/local/lib/ruby/gems/1.8/gems/memcache-client-1.6.5/lib/
memcache.rb:303:in `set'
from /opt/local/lib/ruby/gems/1.8/gems/starling-0.9.8/lib/starling.rb:
34:in `set'
from (irb):4
irb(main):005:0> %

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



[Rails] Re: Rails 2.1.2 to 2.3.2 problems

2009-03-25 Thread Bharat Ruparel

Thanks Fred.  Here is what I did after reading the link that you posted:

I created the config/initializers/load_lib_dir.rb with the following 
line of code:

Dir.glob( "#{ RAILS_ROOT }/lib/*.rb" ).each { |f| require f } <-- thanks 
Greg.

I guess, I have some homework to do on the initializers.

Regards,

Bharat


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

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



[Rails] Re: Rails 2.1.2 to 2.3.2 problems

2009-03-25 Thread Frederick Cheung



On Mar 25, 11:36 pm, Bharat Ruparel 
wrote:
> Figured it out:
>
> Rails 2.3 has a problem with requiring any files within the initializer
> block as shown below.
>
> Rails::Initializer.run do |config|
>
>   require "#{RAILS_ROOT}/lib/active_record_extensions.rb"
>
> end

ActiveRecord is not loaded at this point. The right place for this
sort of stuff is in an initializer (see
http://www.spacevatican.org/2008/11/21/environment-rb-and-requiring-dependencies
for ways where putting it at the bottom of environment.rb can go
wrong).

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



[Rails] Re: Rails 2.1.2 to 2.3.2 problems

2009-03-25 Thread Bharat Ruparel

Figured it out:

Rails 2.3 has a problem with requiring any files within the initializer 
block as shown below.

Rails::Initializer.run do |config|

  require "#{RAILS_ROOT}/lib/active_record_extensions.rb"

end

Instead, it wants you to put your require statement outside the block as 
shown below:

Rails::Initializer.run do |config|

   .


end
require "#{RAILS_ROOT}/lib/active_record_extensions.rb"

This works.  Why is it so?  I do not know.  If someone can explain this, 
I would appreciate it.

Thanks.

Bharat

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

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



[Rails] Re: Does putting methods in Application.rb slow things down?

2009-03-25 Thread Maurício Linhares

No.

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)



On Wed, Mar 25, 2009 at 7:53 PM, David  wrote:
>
> I'm wondering if including a method or a library or a stylesheet in
> Application.rb will slow things down for a controller that doesn't use
> any of what is listed above?
> >
>

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



[Rails] Does putting methods in Application.rb slow things down?

2009-03-25 Thread David

I'm wondering if including a method or a library or a stylesheet in
Application.rb will slow things down for a controller that doesn't use
any of what is listed above?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Database Error?

2009-03-25 Thread Maurício Linhares

I'm not really sure where you saw this, but all of those posts are
clearly wrong.

This is what you're going to find at the rails initializer:

RAILS_ENV = (ENV['RAILS_ENV'] || 'development').dup unless defined?(RAILS_ENV)

The RAILS_ENV environment variable is where Rails is usually going to
find out at which environment it is (this is specially true at Rake
tasks), your code shouldn't depend on it, as you should get the
current Rails env by doing "Rails.env" (instead of using the constant
as you are), but it is not deprecated. It's just not meant to be used
the way you were trying to.

And instead of using RAILS_ENV, try using Rails.env.

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)

On Wed, Mar 25, 2009 at 7:29 PM, Sean McGilvray  wrote:
> Several post that I have read say that it is deprecated.  When I switched
> from using
>
> ENV['RAILS_ENV'] ||= 'production'
>
> to using
>
> RAILS_ENV='production'
>
> in my environment file my app now loads in production just fine.  When I was
> using ENV['RAILS_ENV'] ||= 'production' it kept coming up in development.
>

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



[Rails] Re: "mysql" 2.7.3 gem install for Windows appears incomplete

2009-03-25 Thread Jaime Jimmy

Dave Min wrote:
> The solution I found for this problem (the [BUG] Segmentation fault 
> error) was to install Mysql 5.0.67 rather than the latest stable version 
> of Mysql 5.1.30.
> 
> Wes Gamble wrote:
>> Rick wrote:
>>> 
>>> ruby ./test.rb -- localhost test test testDB
>>> 
>> 
>> I get this when I run test.rb:
>> 
>> C:\ruby\lib\ruby\gems\1.8\gems\mysql-2.7.3-x86-mswin32\ext>ruby test.rb 
>> -- local
>> host test test testDB
>> Loaded suite test
>> Started
>> .FE..C:/ruby/lib/ruby/1.8/test/unit/assertions.rb:497: [BUG] 
>> Segmentation fault
>> ruby 1.8.6 (2007-09-24) [i386-mswin32]
>> 
>> 
>> This application has requested the Runtime to terminate it in an unusual 
>> way.
>> Please contact the application's support team for more information.
>> 
>> Wes

I think the problem is the client version of libmysql.dll . If ruby is 
using libmysql.dll 5.1.X from %PATH% or from \bin you get this 
error. The solution is to replace this library with libmysql.dll 5.0.X. 
I got mine from php installation and everything start running fine.

Saludos,

Jaime
This is a hack to avoid reinstalling the server again.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: ActiveRecord: Nested :include erroneous behavior

2009-03-25 Thread akshay rawat
The ticket is at
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2341-nested-finder-include-option-with-has_one#ticket-2341-4

Not sure how the ticket assignment thing works ;)

Thanks

On Wed, Mar 25, 2009 at 6:43 PM, akshay rawat wrote:

> Just checked, this test fails on Rails 2.3.2 too.
> Thanks for looking into it.
>
>
> On Wed, Mar 25, 2009 at 6:24 PM, Frederick Cheung <
> frederick.che...@gmail.com> wrote:
>
>>
>>
>>
>> On Mar 25, 10:01 pm, akshay rawat  wrote:
>> > So is this a valid Rails bug ? Should I create a ticket for it on
>> Lighthouse
>> > ?
>>
>> Seems like you already have :-). I'd definitely check against 2.3.2 -
>> I remember there being a fix for a :include bug somewhere.
>>
>> Fred
>> >
>> > On Wed, Mar 25, 2009 at 3:02 PM, akshay rawat > >wrote:
>> >
>> > > Yup, it passes without the :order option, indicating that there is a
>> > > problem with the join based mechanism. Thanks
>> >
>> > > On Wed, Mar 25, 2009 at 2:49 PM, Frederick Cheung <
>> > > frederick.che...@gmail.com> wrote:
>> >
>> > >> On Mar 25, 6:39 pm, akshay rawat  wrote:
>> > >> > Thanks for looking at it.A one file test -http://pastie.org/426840
>> >
>> > >> > Another thing I saw was that the that test passes when :include is
>> > >> replaced
>> > >> > with :joins.
>> >
>> > >> Not surprising - in that case the association isn't eager loaded at
>> > >> all. If it passes without the order clause then you've narrowed it
>> > >> down to the joins based include mechanism.
>> >
>> > >> Fred
>> >
>> > >> > On Wed, Mar 25, 2009 at 2:05 PM, Frederick Cheung <
>> >
>> > >> > frederick.che...@gmail.com> wrote:
>> >
>> > >> > > On Mar 25, 1:45 pm, akshay.ra...@gmail.com wrote:
>> > >> > > > Bad paste. The problem again. Looks like it is a problem only
>> when
>> > >> there
>> > >> > > is
>> > >> > > > a has_one relationship.
>> >
>> > >> > > Do you need all these models/associations or is there a small
>> test
>> > >> > > case that fails ?
>> >
>> > >> > > Fred
>> > >> > > > class Book < ActiveRecord::Base
>> > >> > > > has_one :distributor
>> > >> > > > end
>> >
>> > >> > > > class Distributor < ActiveRecord::Base
>> > >> > > > belongs_to :book
>> > >> > > > has_many :agents
>> > >> > > > end
>> >
>> > >> > > > class Agent < ActiveRecord::Base
>> > >> > > > belongs_to :distributor
>> > >> > > > has_many :shops
>> > >> > > > end
>> >
>> > >> > > > class Shop < ActiveRecord::Base
>> > >> > > > belongs_to :agent
>> > >> > > > end
>> >
>> > >> > > > Schema -http://pastie.org/426261
>> >
>> > >> > > > def test_should_load_avatars
>> > >> > > > shop_1= Shop.create!
>> > >> > > > shop_2= Shop.create!
>> > >> > > > book= Book.create!(:distributor =>
>> Distributor.create!(:agents=>
>> > >> > > > [Agent.create!(:shops => [shop_1, shop_2])]))
>> >
>> > >> > > > loaded_version = Book.find(book.id, :include => [:distributor
>> =>
>> > >> > > {:agents
>> > >> > > > => :shops}], :order => 'shops.id')
>> >
>> > >> > > > assert(loaded_version.distributor.agents.first.shops.size == 2)
>> > >> > > > #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD OF 2
>> > >> > > > end
>> >
>> > >> > > > This fails on Rails 2.2.2.
>> > >> > > > Any help on this would be much appreciated,
>> > >> > > > Akshay
>> >
>> > >> > > > On Mar 25, 2009 4:04am, Frederick Cheung <
>> > >> frederick.che...@gmail.com>
>> > >> > > wrote:
>> >
>> > >> > > > > On Mar 25, 5:19 am, Akshay Rawat akshay.ra...@gmail.com>
>> wrote:
>> > >> > > > > > def test_should_load_avatars
>> > >> > > > > > shop_1= Shop.create!
>> > >> > > > > > shop_2= Shop.create!
>> > >> > > > > > book= Book.create!(:distributors =>
>> > >> [Distributor.create!(:agents=>
>> > >> > > > > > [Agent.create!(:shops => [shop_2, shop_2])])])
>> >
>> > >> > > > > > loaded_version = Book.find(book.id, :include =>
>> [:distributors
>> > >> =>
>> > >> > > > > > {:agents => :shops}], :order => 'shops.id')
>> >
>> > >> > > > > >
>> assert(loaded_version.distributors.first.agents.first.shops.size
>> > >> ==
>> > >> > > > > > 2) #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD
>> OF 2
>> > >> > > > > > end
>> >
>> > >> > > > > > On some investigation, I found that the query fired was
>> correct,
>> > >> but
>> > >> > > > > > Rails was unable to instantiate the 'shops' collection
>> properly.
>> >
>> > >> > > > > The problem is not to do with the nested-ness of the includes
>> but
>> > >> > > > > because you have an agent with the same shop twice (the line
>> in
>> > >> > > > > question that removes duplicates is
>> >
>> > >>http://github.com/rails/rails/blob/f97832b1e4406a76d268a96b521d2297ad
>> .
>> > >> > > ..
>> > >> > > > > Fred
>> > >> > > > > > Any help on this issue would be appreciated.
>> >
>> > >> > > > > > 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, s

[Rails] Re: ActiveRecord: Nested :include erroneous behavior

2009-03-25 Thread akshay rawat
Just checked, this test fails on Rails 2.3.2 too.
Thanks for looking into it.

On Wed, Mar 25, 2009 at 6:24 PM, Frederick Cheung <
frederick.che...@gmail.com> wrote:

>
>
>
> On Mar 25, 10:01 pm, akshay rawat  wrote:
> > So is this a valid Rails bug ? Should I create a ticket for it on
> Lighthouse
> > ?
>
> Seems like you already have :-). I'd definitely check against 2.3.2 -
> I remember there being a fix for a :include bug somewhere.
>
> Fred
> >
> > On Wed, Mar 25, 2009 at 3:02 PM, akshay rawat  >wrote:
> >
> > > Yup, it passes without the :order option, indicating that there is a
> > > problem with the join based mechanism. Thanks
> >
> > > On Wed, Mar 25, 2009 at 2:49 PM, Frederick Cheung <
> > > frederick.che...@gmail.com> wrote:
> >
> > >> On Mar 25, 6:39 pm, akshay rawat  wrote:
> > >> > Thanks for looking at it.A one file test -http://pastie.org/426840
> >
> > >> > Another thing I saw was that the that test passes when :include is
> > >> replaced
> > >> > with :joins.
> >
> > >> Not surprising - in that case the association isn't eager loaded at
> > >> all. If it passes without the order clause then you've narrowed it
> > >> down to the joins based include mechanism.
> >
> > >> Fred
> >
> > >> > On Wed, Mar 25, 2009 at 2:05 PM, Frederick Cheung <
> >
> > >> > frederick.che...@gmail.com> wrote:
> >
> > >> > > On Mar 25, 1:45 pm, akshay.ra...@gmail.com wrote:
> > >> > > > Bad paste. The problem again. Looks like it is a problem only
> when
> > >> there
> > >> > > is
> > >> > > > a has_one relationship.
> >
> > >> > > Do you need all these models/associations or is there a small test
> > >> > > case that fails ?
> >
> > >> > > Fred
> > >> > > > class Book < ActiveRecord::Base
> > >> > > > has_one :distributor
> > >> > > > end
> >
> > >> > > > class Distributor < ActiveRecord::Base
> > >> > > > belongs_to :book
> > >> > > > has_many :agents
> > >> > > > end
> >
> > >> > > > class Agent < ActiveRecord::Base
> > >> > > > belongs_to :distributor
> > >> > > > has_many :shops
> > >> > > > end
> >
> > >> > > > class Shop < ActiveRecord::Base
> > >> > > > belongs_to :agent
> > >> > > > end
> >
> > >> > > > Schema -http://pastie.org/426261
> >
> > >> > > > def test_should_load_avatars
> > >> > > > shop_1= Shop.create!
> > >> > > > shop_2= Shop.create!
> > >> > > > book= Book.create!(:distributor => Distributor.create!(:agents=>
> > >> > > > [Agent.create!(:shops => [shop_1, shop_2])]))
> >
> > >> > > > loaded_version = Book.find(book.id, :include => [:distributor
> =>
> > >> > > {:agents
> > >> > > > => :shops}], :order => 'shops.id')
> >
> > >> > > > assert(loaded_version.distributor.agents.first.shops.size == 2)
> > >> > > > #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD OF 2
> > >> > > > end
> >
> > >> > > > This fails on Rails 2.2.2.
> > >> > > > Any help on this would be much appreciated,
> > >> > > > Akshay
> >
> > >> > > > On Mar 25, 2009 4:04am, Frederick Cheung <
> > >> frederick.che...@gmail.com>
> > >> > > wrote:
> >
> > >> > > > > On Mar 25, 5:19 am, Akshay Rawat akshay.ra...@gmail.com>
> wrote:
> > >> > > > > > def test_should_load_avatars
> > >> > > > > > shop_1= Shop.create!
> > >> > > > > > shop_2= Shop.create!
> > >> > > > > > book= Book.create!(:distributors =>
> > >> [Distributor.create!(:agents=>
> > >> > > > > > [Agent.create!(:shops => [shop_2, shop_2])])])
> >
> > >> > > > > > loaded_version = Book.find(book.id, :include =>
> [:distributors
> > >> =>
> > >> > > > > > {:agents => :shops}], :order => 'shops.id')
> >
> > >> > > > > >
> assert(loaded_version.distributors.first.agents.first.shops.size
> > >> ==
> > >> > > > > > 2) #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD OF
> 2
> > >> > > > > > end
> >
> > >> > > > > > On some investigation, I found that the query fired was
> correct,
> > >> but
> > >> > > > > > Rails was unable to instantiate the 'shops' collection
> properly.
> >
> > >> > > > > The problem is not to do with the nested-ness of the includes
> but
> > >> > > > > because you have an agent with the same shop twice (the line
> in
> > >> > > > > question that removes duplicates is
> >
> > >>http://github.com/rails/rails/blob/f97832b1e4406a76d268a96b521d2297ad.
> > >> > > ..
> > >> > > > > Fred
> > >> > > > > > Any help on this issue would be appreciated.
> >
> > >> > > > > > Thanks
> >
>

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



[Rails] Re: Rails 2.1.2 to 2.3.2 problems

2009-03-25 Thread Bharat Ruparel

Hello Conrad,
I am making good progress towards resolving this, but am not there 
entirely.  Following is my abbreviated environment.rb file.  Note that I 
have commented out the RAILS_GEM_VERSION line so that the latest rails 
2.3.2 is loaded.

# Specifies gem version of Rails to use when vendor/rails is not present
#RAILS_GEM_VERSION = '2.1.2' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')

Rails::Initializer.run do |config|

  # Add additional load paths for your own custom dirs
  config.load_paths += %W( #{RAILS_ROOT}/app/form_builders )

  config.time_zone = 'UTC'

  config.action_controller.session = {
:session_key => '_pizzeria_session',
:secret  => 
'1cac89a5ef8e67d30b297648243baee84a52d16dbbf11690733a73c825da43c327a6552f9498d0fe2ecf29cbc09ebf6115102fe3d26f969909f005dc1da39e09'
  }


  require "#{RAILS_ROOT}/lib/active_record_extensions.rb"

end

if I comment out the last require 
"#{RAILS_ROOT}/lib/active_record_extensions.rb"

statement as shown below:

# require "#{RAILS_ROOT}/lib/active_record_extensions.rb"

and restart the server then it boots and everything works fine except 
where I need the functionality contained in 
lib/active_record_extensions.rb file which is as follows:

module ActiveRecord

  class Base
def self.search(search, current_page, search_field)
  if search.blank?
paginate(:all, :page => current_page || 1, :per_page => 5)
  else
paginate(:all, :conditions => ["#{search_field} LIKE ?", 
"%#{search}%"], :order => 'name',
  :page => current_page || 1, :per_page => 5)
  end
end
  end

end

Why does Rails 2.3.2 have a problem with it when 2.1.2 does not?  The 
error messages are very misleading and point to some problem with 
database when there is none?


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

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



[Rails] Re: Database Error?

2009-03-25 Thread Sean McGilvray
Several post that I have read say that it is deprecated.  When I switched
from using

ENV['RAILS_ENV'] ||= 'production'

to using

RAILS_ENV='production'

in my environment file my app now loads in production just fine.  When I was
using ENV['RAILS_ENV'] ||= 'production' it kept coming up in development.

Sean McGilvray
Execitve Director
Identity Theft Specialist
Pre-Paid Legal Service's, Inc. NYSE:PPD
Phone:  760-486-1019
smcgilv...@prepaidlegal.com
http://www.transferhome.net


2009/3/25 Maurício Linhares 

>
> It isn't deprecated, it just not always set, as in the dev
> environment, for example.
>
> -
> Maurício Linhares
> http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)
>
> On Wed, Mar 25, 2009 at 7:19 PM, Sean McGilvray 
> wrote:
> > I figured out why this was happening.
> >
> > I switched to RAILS_ENV='production'
> >
> > ENV["RAILS_ENV"] has been deprecated.
> >
> > I did not know that ENV["RAILS_ENV"] has been deprecated.
> >
> >
> > Thanks for the help.
> >
> > Sean McGilvray
> > Executive Director
> > Identity Theft Specialist
> > Pre-Paid Legal Service's, Inc. NYSE:PPD
> > Phone:  760-486-1019
> > smcgilv...@prepaidlegal.com
> > http://www.transferhome.net
> >
>
> >
>

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



[Rails] Re: ActiveRecord: Nested :include erroneous behavior

2009-03-25 Thread Frederick Cheung



On Mar 25, 10:01 pm, akshay rawat  wrote:
> So is this a valid Rails bug ? Should I create a ticket for it on Lighthouse
> ?

Seems like you already have :-). I'd definitely check against 2.3.2 -
I remember there being a fix for a :include bug somewhere.

Fred
>
> On Wed, Mar 25, 2009 at 3:02 PM, akshay rawat wrote:
>
> > Yup, it passes without the :order option, indicating that there is a
> > problem with the join based mechanism. Thanks
>
> > On Wed, Mar 25, 2009 at 2:49 PM, Frederick Cheung <
> > frederick.che...@gmail.com> wrote:
>
> >> On Mar 25, 6:39 pm, akshay rawat  wrote:
> >> > Thanks for looking at it.A one file test -http://pastie.org/426840
>
> >> > Another thing I saw was that the that test passes when :include is
> >> replaced
> >> > with :joins.
>
> >> Not surprising - in that case the association isn't eager loaded at
> >> all. If it passes without the order clause then you've narrowed it
> >> down to the joins based include mechanism.
>
> >> Fred
>
> >> > On Wed, Mar 25, 2009 at 2:05 PM, Frederick Cheung <
>
> >> > frederick.che...@gmail.com> wrote:
>
> >> > > On Mar 25, 1:45 pm, akshay.ra...@gmail.com wrote:
> >> > > > Bad paste. The problem again. Looks like it is a problem only when
> >> there
> >> > > is
> >> > > > a has_one relationship.
>
> >> > > Do you need all these models/associations or is there a small test
> >> > > case that fails ?
>
> >> > > Fred
> >> > > > class Book < ActiveRecord::Base
> >> > > > has_one :distributor
> >> > > > end
>
> >> > > > class Distributor < ActiveRecord::Base
> >> > > > belongs_to :book
> >> > > > has_many :agents
> >> > > > end
>
> >> > > > class Agent < ActiveRecord::Base
> >> > > > belongs_to :distributor
> >> > > > has_many :shops
> >> > > > end
>
> >> > > > class Shop < ActiveRecord::Base
> >> > > > belongs_to :agent
> >> > > > end
>
> >> > > > Schema -http://pastie.org/426261
>
> >> > > > def test_should_load_avatars
> >> > > > shop_1= Shop.create!
> >> > > > shop_2= Shop.create!
> >> > > > book= Book.create!(:distributor => Distributor.create!(:agents=>
> >> > > > [Agent.create!(:shops => [shop_1, shop_2])]))
>
> >> > > > loaded_version = Book.find(book.id, :include => [:distributor =>
> >> > > {:agents
> >> > > > => :shops}], :order => 'shops.id')
>
> >> > > > assert(loaded_version.distributor.agents.first.shops.size == 2)
> >> > > > #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD OF 2
> >> > > > end
>
> >> > > > This fails on Rails 2.2.2.
> >> > > > Any help on this would be much appreciated,
> >> > > > Akshay
>
> >> > > > On Mar 25, 2009 4:04am, Frederick Cheung <
> >> frederick.che...@gmail.com>
> >> > > wrote:
>
> >> > > > > On Mar 25, 5:19 am, Akshay Rawat akshay.ra...@gmail.com> wrote:
> >> > > > > > def test_should_load_avatars
> >> > > > > > shop_1= Shop.create!
> >> > > > > > shop_2= Shop.create!
> >> > > > > > book= Book.create!(:distributors =>
> >> [Distributor.create!(:agents=>
> >> > > > > > [Agent.create!(:shops => [shop_2, shop_2])])])
>
> >> > > > > > loaded_version = Book.find(book.id, :include => [:distributors
> >> =>
> >> > > > > > {:agents => :shops}], :order => 'shops.id')
>
> >> > > > > > assert(loaded_version.distributors.first.agents.first.shops.size
> >> ==
> >> > > > > > 2) #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD OF 2
> >> > > > > > end
>
> >> > > > > > On some investigation, I found that the query fired was correct,
> >> but
> >> > > > > > Rails was unable to instantiate the 'shops' collection properly.
>
> >> > > > > The problem is not to do with the nested-ness of the includes but
> >> > > > > because you have an agent with the same shop twice (the line in
> >> > > > > question that removes duplicates is
>
> >>http://github.com/rails/rails/blob/f97832b1e4406a76d268a96b521d2297ad.
> >> > > ..
> >> > > > > Fred
> >> > > > > > Any help on this issue would be appreciated.
>
> >> > > > > > Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Database Error?

2009-03-25 Thread Maurício Linhares

It isn't deprecated, it just not always set, as in the dev
environment, for example.

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)

On Wed, Mar 25, 2009 at 7:19 PM, Sean McGilvray  wrote:
> I figured out why this was happening.
>
> I switched to RAILS_ENV='production'
>
> ENV["RAILS_ENV"] has been deprecated.
>
> I did not know that ENV["RAILS_ENV"] has been deprecated.
>
>
> Thanks for the help.
>
> Sean McGilvray
> Executive Director
> Identity Theft Specialist
> Pre-Paid Legal Service's, Inc. NYSE:PPD
> Phone:  760-486-1019
> smcgilv...@prepaidlegal.com
> http://www.transferhome.net
>

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



[Rails] Re: curious how params, flash etc work in rails ?

2009-03-25 Thread Frederick Cheung



On Mar 25, 10:07 pm, Larz  wrote:
> ok,
>
>  offhand I'm not sure how to create a method foo that is used like an
> array so I can say foo[:id], but I'll have to think about that or look
> through my books ...
>

There's not much to it:

class Foo
  def initialize
@hash = {}
  end

  def [](key)
@hash[key]
  end

  def []=(key,value)
@hash[key]=value
  end
end

That's not what's happening with params though. That's just a method
that returns a hash.

Fred
> On Mar 25, 5:46 pm, Frederick Cheung 
> wrote:
>
> > On Mar 25, 8:57 pm, "wbsurf...@yahoo.com"  wrote:
>
> > >  I am curious how stuff like params and flash work in the controller ?
> > > Typically an instance variable is something like
> > > @params, or maybe self.params
>
> > @params is an instance variable, but self.params is a method called
> > params
>
> > > How does rails make params appear as if
> > > it's an instance variable ?
>
> > it doesn't. It just defines a method called params (and one called
> > flash etc...) on controllers. There use to be instance variables
> > called @params, @flash that you could use interchangeably but use of
> > those was deprecated and removed a while back.
>
> > 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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Database Error?

2009-03-25 Thread Sean McGilvray
I figured out why this was happening.

I switched to RAILS_ENV='production'

ENV["RAILS_ENV"] has been deprecated.


I did not know that ENV["RAILS_ENV"] has been deprecated.


Thanks for the help.

Sean McGilvray
Executive Director
Identity Theft Specialist
Pre-Paid Legal Service's, Inc. NYSE:PPD
Phone:  760-486-1019
smcgilv...@prepaidlegal.com
http://www.transferhome.net


On Wed, Mar 25, 2009 at 2:39 PM, Frederick Cheung <
frederick.che...@gmail.com> wrote:

>
>
>
> On Mar 25, 8:24 pm, Sean McGilvray  wrote:
> > Yes that works.  How do I fix the problem of the correct environment not
> > loading?
> >
> Looks like nothing set the RAILS_ENV environment variable and so it
> defaulted to development (things that run apps such as mongrel or
> passenger usually have this as an explicit option in the
> configuration). You need to  either:
> - always specify RAILS_ENV when doing something
> - fiddle with the files appropriate to your shell and operating system
> so that the environment variable is always set for you.
>
> Fred
>
> > Sean McGilvray & Sarena Byers
> > Director
> > Identity Theft Specialist
> > Pre-Paid Legal Service's, Inc. NYSE:PPD
> > Phone:  760-486-1019
> > smcgilv...@prepaidlegal.comhttp://www.transferhome.net
> >
> > On Wed, Mar 25, 2009 at 12:03 PM, Frederick Cheung <
> >
> > frederick.che...@gmail.com> wrote:
> >
> > > On Mar 25, 6:58 pm, Sean McGilvray  wrote:
> > > > No, my database.yml has the correct settings:
> >
> > > which implies that the correct environment isn't loaded. does
> > > RAILS_ENV=production rake db:load_csv_data
> > > work any better?
> >
> > > Fred
> > > > production:
> > > >   adapter: mysql
> > > >   database: DB_NAME
> > > >   username: USER_NAME
> > > >   password: PASSWORD
> > > >   host: 127.0.0.1
> >
> > > > Sean McGilvray
> > > > Executive Director
> > > > Identity Theft Specialist
> > > > Pre-Paid Legal Service's, Inc. NYSE:PPD
> > > > Phone:  760-486-1019
> > > > smcgilv...@prepaidlegal.comhttp://www.transferhome.net
> >
> > > > On Wed, Mar 25, 2009 at 11:47 AM, Frederick Cheung <
> >
> > > > frederick.che...@gmail.com> wrote:
> >
> > > > > On Mar 25, 6:41 pm, Sean McGilvray  wrote:
> > > > > > Hello everyone,
> > > > > > I am getting this database connection error when I run a rake
> task or
> > > > > > when I try to send with ar_mailer.  My app works fine that I know
> of
> > > > > > but I went to import users into the database and this is what I
> get.
> >
> > > > > > rake db:load_csv_data --trace
> > > > > > (in /home/greatcar/gcp)
> > > > > > ** Invoke db:load_csv_data (first_time)
> > > > > > ** Invoke environment (first_time)
> > > > > > ** Execute environment
> > > > > > ** Execute db:load_csv_data
> > > > > > rake aborted!
> > > > > > Access denied for user 'root'@'localhost' (using password: NO)
> >
> > > > > Should it be connecting as root ?
> >
> > > > > 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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Ruby on Rails Developer

2009-03-25 Thread Shveta

ProKarma is a full service company offering IT Services & Solutions,
IT Outsourcing Services, BPO Services, Utility Management, Procurement
Management, and Software Products.  We have a very Strong delivery
capability, a highly valuable client base and a superior growth
profile.  The company's clients include industry leaders in
transportation, insurance, entertainment, healthcare and retailing.
The company has experienced rapid growth since its inception in 2001,
and has established offices in Omaha, Denver, Portland, Sacramento,
Columbus, Houston and Hyderabad, India. For more information visit us
at http://www.prokarma.com.



We need Ruby on Rail Developer in Denver, CO. An individual with Java
exp is plus.



3+ years experience with Object Oriented analysis and design and MVC
programming concepts, preferably in Ruby on Rails
3+ years of standards compliant HTML/XHTML, CSS, and JavaScript (cross-
platform browser compatibility a must)
Javascript skills (AJAX, DHTML, Prototype/Scriptaculous in
particular)


Please get back to me at shv...@prokarma.com


Thank you and I look forward working with you.



Shveta Ilwadi
402.333.5869 (FAX)
253.486.7125 (Off)
www.prokarma.com
shv...@prokarma.com


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



[Rails] Re: advanced search for a model (including keywords)

2009-03-25 Thread aupayo

And, besides using ferret or sphinx, should I also use
acts_as_taggable in order to manage the keywords for each item?

On 25 mar, 18:42, Freddy Andersen  wrote:
> I personally had many issues trying to use Ferret and would recommend
> Sphinx with thinking sphinx plugin.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: curious how params, flash etc work in rails ?

2009-03-25 Thread Larz


ok,

 offhand I'm not sure how to create a method foo that is used like an
array so I can say foo[:id], but I'll have to think about that or look
through my books ...



On Mar 25, 5:46 pm, Frederick Cheung 
wrote:
> On Mar 25, 8:57 pm, "wbsurf...@yahoo.com"  wrote:
>
> >  I am curious how stuff like params and flash work in the controller ?
> > Typically an instance variable is something like
> > @params, or maybe self.params
>
> @params is an instance variable, but self.params is a method called
> params
>
> > How does rails make params appear as if
> > it's an instance variable ?
>
> it doesn't. It just defines a method called params (and one called
> flash etc...) on controllers. There use to be instance variables
> called @params, @flash that you could use interchangeably but use of
> those was deprecated and removed a while back.
>
> 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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: ActiveRecord: Nested :include erroneous behavior

2009-03-25 Thread akshay rawat
So is this a valid Rails bug ? Should I create a ticket for it on Lighthouse
?

On Wed, Mar 25, 2009 at 3:02 PM, akshay rawat wrote:

> Yup, it passes without the :order option, indicating that there is a
> problem with the join based mechanism. Thanks
>
>
> On Wed, Mar 25, 2009 at 2:49 PM, Frederick Cheung <
> frederick.che...@gmail.com> wrote:
>
>>
>>
>>
>> On Mar 25, 6:39 pm, akshay rawat  wrote:
>> > Thanks for looking at it.A one file test -http://pastie.org/426840
>> >
>> > Another thing I saw was that the that test passes when :include is
>> replaced
>> > with :joins.
>>
>> Not surprising - in that case the association isn't eager loaded at
>> all. If it passes without the order clause then you've narrowed it
>> down to the joins based include mechanism.
>>
>> Fred
>> >
>> > On Wed, Mar 25, 2009 at 2:05 PM, Frederick Cheung <
>> >
>> > frederick.che...@gmail.com> wrote:
>> >
>> > > On Mar 25, 1:45 pm, akshay.ra...@gmail.com wrote:
>> > > > Bad paste. The problem again. Looks like it is a problem only when
>> there
>> > > is
>> > > > a has_one relationship.
>> >
>> > > Do you need all these models/associations or is there a small test
>> > > case that fails ?
>> >
>> > > Fred
>> > > > class Book < ActiveRecord::Base
>> > > > has_one :distributor
>> > > > end
>> >
>> > > > class Distributor < ActiveRecord::Base
>> > > > belongs_to :book
>> > > > has_many :agents
>> > > > end
>> >
>> > > > class Agent < ActiveRecord::Base
>> > > > belongs_to :distributor
>> > > > has_many :shops
>> > > > end
>> >
>> > > > class Shop < ActiveRecord::Base
>> > > > belongs_to :agent
>> > > > end
>> >
>> > > > Schema -http://pastie.org/426261
>> >
>> > > > def test_should_load_avatars
>> > > > shop_1= Shop.create!
>> > > > shop_2= Shop.create!
>> > > > book= Book.create!(:distributor => Distributor.create!(:agents=>
>> > > > [Agent.create!(:shops => [shop_1, shop_2])]))
>> >
>> > > > loaded_version = Book.find(book.id, :include => [:distributor =>
>> > > {:agents
>> > > > => :shops}], :order => 'shops.id')
>> >
>> > > > assert(loaded_version.distributor.agents.first.shops.size == 2)
>> > > > #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD OF 2
>> > > > end
>> >
>> > > > This fails on Rails 2.2.2.
>> > > > Any help on this would be much appreciated,
>> > > > Akshay
>> >
>> > > > On Mar 25, 2009 4:04am, Frederick Cheung <
>> frederick.che...@gmail.com>
>> > > wrote:
>> >
>> > > > > On Mar 25, 5:19 am, Akshay Rawat akshay.ra...@gmail.com> wrote:
>> > > > > > def test_should_load_avatars
>> > > > > > shop_1= Shop.create!
>> > > > > > shop_2= Shop.create!
>> > > > > > book= Book.create!(:distributors =>
>> [Distributor.create!(:agents=>
>> > > > > > [Agent.create!(:shops => [shop_2, shop_2])])])
>> >
>> > > > > > loaded_version = Book.find(book.id, :include => [:distributors
>> =>
>> > > > > > {:agents => :shops}], :order => 'shops.id')
>> >
>> > > > > > assert(loaded_version.distributors.first.agents.first.shops.size
>> ==
>> > > > > > 2) #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD OF 2
>> > > > > > end
>> >
>> > > > > > On some investigation, I found that the query fired was correct,
>> but
>> > > > > > Rails was unable to instantiate the 'shops' collection properly.
>> >
>> > > > > The problem is not to do with the nested-ness of the includes but
>> > > > > because you have an agent with the same shop twice (the line in
>> > > > > question that removes duplicates is
>> > > > >
>> http://github.com/rails/rails/blob/f97832b1e4406a76d268a96b521d2297ad.
>> > > ..
>> > > > > Fred
>> > > > > > Any help on this issue would be appreciated.
>> >
>> > > > > > Thanks
>> >>
>>
>

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



[Rails] Re: MonkeyPatching ActiveRecord::Base class

2009-03-25 Thread Bharat Ruparel

"However when you have a file in lib that is just adding a method to
some existing class or overriding something then there is no constant
like Discombobulator that will trigger loading of the file."

Got it.  Thanks.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: remote_form_for ajax validation

2009-03-25 Thread eric

Like commonly with regular forms, I prefer javascript validation
before the form submits. I happened across what I think is a valid
method.

<% remote_form_for(product, :before => "if(!validateForm(this))
{ return false; }") %>

Where validateForm is a javascript function that does the form
validation. Note that using this method, the javascript function MUST
return a boolean, either true for valid data, or false if not. If it's
not valid then the form won't submit. Within the javascript you can
put alerts or change the html with error messages so that the user can
correct their input data.


On Mar 15, 3:59 pm, Isaac  wrote:
> Hi,
>
> I have been reading a lot about this, but I do not manage to do a nice
> validation. I already managed to save data to the database, to
> validate a field, to display a "Everything went well" message. I can
> also display an error message, but the view does not end up properly.
>
> This is the form:
>
> <% remote_form_for(product) do |f| %>
>     <%= f.error_messages %>
>           
>                   <%= f.label :title  %>
>                   <%= f.text_field :title %>
>           
>           
>                   <%= f.label :body  %>
>                   <%= f.text_area :body %>
>           
>           
>             <%= f.submit "Update" %> ó
>          
>   <% end %>
>
> This is the controller:
>
> def update
>     @product = Product.find(params[:id])
>     respond_to do |format|
>       if @product.update_attributes(params[:product])
>         flash[:notice] = 'OK!'
>         format.html { redirect_to(@product) }
>         format.js
>       else
>         flash.now[:notice] = 'Error!!'
>         format.html { render :action => "show" }
>         format.xml { render :xml => @product.errors,  :status
> => :unprocessable_entity }
>         format.js
>       end
>     end
>   end
>
> The model:
>
> class Product < ActiveRecord::Base
>   validates_presence_of :title
> end
>
> And the RJS template:
>
> page.replace_html :description, :partial => "product", :object =>
> @product
> page.replace_html :notice, flash[:notice]
> page.visual_effect (:fade, "notice", :duration => 2)
> flash.discard
>
> But I thing there is a better way to validate forms.
>
> Does any one have an example about validating, and displaying
> customized messages.
>
> Br,
>
> Isaac

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



[Rails] Re: curious how params, flash etc work in rails ?

2009-03-25 Thread Frederick Cheung



On Mar 25, 8:57 pm, "wbsurf...@yahoo.com"  wrote:
>  I am curious how stuff like params and flash work in the controller ?
> Typically an instance variable is something like
> @params, or maybe self.params

@params is an instance variable, but self.params is a method called
params

> How does rails make params appear as if
> it's an instance variable ?

it doesn't. It just defines a method called params (and one called
flash etc...) on controllers. There use to be instance variables
called @params, @flash that you could use interchangeably but use of
those was deprecated and removed a while back.

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



[Rails] Re: MonkeyPatching ActiveRecord::Base class

2009-03-25 Thread Frederick Cheung



On Mar 25, 8:22 pm, Bharat Ruparel 
wrote:
> "The difference with a file like the one you had is that there
> isn't a top level constant one would naturally refer to)"
>
> Thanks for the explanation Fred.  But I don't understand this.  Can you
> give me a simple example?
>
If what you were doing was providing a class that other bits of your
app use then you might have discombobulator.rb which defined
Discombobulator, and bits of your app might do
Discombobulator.discombobulate. When they did that and if the file had
not been loaded yet then this would trigger const_missing (since there
is no Discombobulator constant). Rails' response to this is to search
for a file called discombobulator.rb and try and load it.

However when you have a file in lib that is just adding a method to
some existing class or overriding something then there is no constant
like Discombobulator that will trigger loading of the file.

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



[Rails] Re: [JOBS] FOSS remote monitoring system is searching for Rails developers

2009-03-25 Thread koopmann.lenn...@googlemail.com



On 25 Mrz., 22:38, Greg Donald  wrote:
> Well what about Cacti, it was not suitable either?
>
> http://www.cacti.net/

Hehe, I also took a look of Cacti. I think I got a pretty good
overview over FOSS remote monitoring software.

> I mean, it's very nice looking, was there something wrong with it as well?

Don't get me wrong. I think most of the other projects are great
software! But they just did not fit my needs so I started writing my
own. ..and from the Feedback I got so far I can say that I am not
alone with that opinion.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Database Error?

2009-03-25 Thread Frederick Cheung



On Mar 25, 8:24 pm, Sean McGilvray  wrote:
> Yes that works.  How do I fix the problem of the correct environment not
> loading?
>
Looks like nothing set the RAILS_ENV environment variable and so it
defaulted to development (things that run apps such as mongrel or
passenger usually have this as an explicit option in the
configuration). You need to  either:
- always specify RAILS_ENV when doing something
- fiddle with the files appropriate to your shell and operating system
so that the environment variable is always set for you.

Fred

> Sean McGilvray & Sarena Byers
> Director
> Identity Theft Specialist
> Pre-Paid Legal Service's, Inc. NYSE:PPD
> Phone:  760-486-1019
> smcgilv...@prepaidlegal.comhttp://www.transferhome.net
>
> On Wed, Mar 25, 2009 at 12:03 PM, Frederick Cheung <
>
> frederick.che...@gmail.com> wrote:
>
> > On Mar 25, 6:58 pm, Sean McGilvray  wrote:
> > > No, my database.yml has the correct settings:
>
> > which implies that the correct environment isn't loaded. does
> > RAILS_ENV=production rake db:load_csv_data
> > work any better?
>
> > Fred
> > > production:
> > >   adapter: mysql
> > >   database: DB_NAME
> > >   username: USER_NAME
> > >   password: PASSWORD
> > >   host: 127.0.0.1
>
> > > Sean McGilvray
> > > Executive Director
> > > Identity Theft Specialist
> > > Pre-Paid Legal Service's, Inc. NYSE:PPD
> > > Phone:  760-486-1019
> > > smcgilv...@prepaidlegal.comhttp://www.transferhome.net
>
> > > On Wed, Mar 25, 2009 at 11:47 AM, Frederick Cheung <
>
> > > frederick.che...@gmail.com> wrote:
>
> > > > On Mar 25, 6:41 pm, Sean McGilvray  wrote:
> > > > > Hello everyone,
> > > > > I am getting this database connection error when I run a rake task or
> > > > > when I try to send with ar_mailer.  My app works fine that I know of
> > > > > but I went to import users into the database and this is what I get.
>
> > > > > rake db:load_csv_data --trace
> > > > > (in /home/greatcar/gcp)
> > > > > ** Invoke db:load_csv_data (first_time)
> > > > > ** Invoke environment (first_time)
> > > > > ** Execute environment
> > > > > ** Execute db:load_csv_data
> > > > > rake aborted!
> > > > > Access denied for user 'root'@'localhost' (using password: NO)
>
> > > > Should it be connecting as root ?
>
> > > > 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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: curious how params, flash etc work in rails ?

2009-03-25 Thread Philip Hallstrom

> I am curious how stuff like params and flash work in the controller ?
> Typically an instance variable is something like
> @params, or maybe self.params. How does rails make params appear as if
> it's an instance variable ?

I believe at one point params was an instance variable.  And there was  
a method "params" that passed through to that instance.  I also  
remember that this was changed awhile back and you should never ever  
use @params again.  That it is no longer a simple instance variable.

As for how they work specifically, dig through the source :)



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



[Rails] Re: [JOBS] FOSS remote monitoring system is searching for Rails developers

2009-03-25 Thread Greg Donald

On Wed, Mar 25, 2009 at 4:31 PM, koopmann.lenn...@googlemail.com
 wrote:
> That is true. But it has been done I a way that did not satisfy me.

Well what about Cacti, it was not suitable either?

http://www.cacti.net/

I mean, it's very nice looking, was there something wrong with it as well?



-- 
Greg Donald
http://destiney.com/

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



[Rails] Re: curious how params, flash etc work in rails ?

2009-03-25 Thread Greg Donald

On Wed, Mar 25, 2009 at 3:57 PM, wbsurf...@yahoo.com
 wrote:
>  I am curious how stuff like params and flash work in the controller ?
> Typically an instance variable is something like
> @params, or maybe self.params. How does rails make params appear as if
> it's an instance variable ?


> irb
>> o = Object.new
=> #
>> o.instance_variable_set( :@foo, 'bar' )
=> "bar"
>> o.inspect
=> "#"
>>

http://www.ruby-doc.org/core/classes/Object.html#M000381


-- 
Greg Donald
http://destiney.com/

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



[Rails] Re: Rails 2.1.2 to 2.3.2 problems

2009-03-25 Thread Bharat Ruparel

Hello Conrad,
you wrote:
> 
> Hi, did you update your configs?
> 
> rake rails:update
> 
> -Conrad

No. I had not done that, but after reading your reply I did, but I get 
the same error :) as can be seen below:

brupa...@bcr-d810:~/exp/pizzeria-3$ cd config/
brupa...@bcr-d810:~/exp/pizzeria-3/config$ vi environment.rb
brupa...@bcr-d810:~/exp/pizzeria-3/config$ cd ..
brupa...@bcr-d810:~/exp/pizzeria-3$ rake rails:update
(in /home/bruparel/exp/pizzeria-3)
/home/bruparel/exp/pizzeria-3/app/controllers/application.rb has been 
renamed to 
/home/bruparel/exp/pizzeria-3/app/controllers/application_controller.rb, 
update your SCM as necessary
brupa...@bcr-d810:~/exp/pizzeria-3$ ruby ./script/server
=> Booting Mongrel
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:416:in 
`initialize_database': undefined method `configurations=' for 
ActiveRecord::Base:Class (NoMethodError)

Note that I edited the environment.rb to set Rails Gems to 2.3.2, but it 
does not work.

Bharat


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

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



[Rails] Re: [JOBS] FOSS remote monitoring system is searching for Rails developers

2009-03-25 Thread koopmann.lenn...@googlemail.com

On 25 Mrz., 22:28, Greg Donald  wrote:
> After looking over your screenshots, I have to ask..  are you not
> aware of Nagios?

I am. And I worked with Nagios and Zabbix for years.

> Between Nagios and MRTG,
> pretty much everything you're doing has already been done.

That is true. But it has been done I a way that did not satisfy me.

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



[Rails] Re: [JOBS] FOSS remote monitoring system is searching for Rails developers

2009-03-25 Thread Greg Donald

On Wed, Mar 25, 2009 at 3:57 PM, koopmann.lenn...@googlemail.com
 wrote:
> Check out http://www.scopeport.org/ for more information about
> ScopePort.

After looking over your screenshots, I have to ask..  are you not
aware of Nagios?  Why reinvent the wheel?  Between Nagios and MRTG,
pretty much everything you're doing has already been done.



-- 
Greg Donald
http://destiney.com/

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



[Rails] Re: Problem with functional test

2009-03-25 Thread Pietia

Ty fred, your solution worked , i just didnt notice that it should
derive from action controller ( i copied heading from unit test )

On 25 Mar, 19:08, Frederick Cheung  wrote:
> On 25 Mar 2009, at 16:37, Pietia wrote:
>
>
>
> > Hi
>
> > I have upgraded to 2.3.2 and changed updated everything inside
> > myproject :
>
> > This is my functional TEST :
>
> > require 'test_helper'
>
> > class Admin::ProjectsControllerTest < ActiveSupport::TestCase
>
> You should have changed that to ActionController::TestCase.
>
> 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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Rails 2.1.2 to 2.3.2 problems

2009-03-25 Thread Conrad Taylor
On Wed, Mar 25, 2009 at 2:09 PM, Bharat Ruparel <
rails-mailing-l...@andreas-s.net> wrote:

>
> I just installed Rails 2.3.2 and tried to upgrade my test app from
> 2.1.2.  After installing Rails 2.3.2, I simply changed the gem version
> in my environment.rb file in config directory as shown below:
>
> # Specifies gem version of Rails to use when vendor/rails is not present
> RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
>
> The server refuses to start and I get the following stacktrace:
>
> => Booting Mongrel
> => Rails 2.3.2 application starting on http://0.0.0.0:3000
> /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:416:in
> `initialize_database': undefined method `configurations=' for
> ActiveRecord::Base:Class (NoMethodError)
>from
> /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:141:in
> `process'
>from
> /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in
> `send'
>from
> /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in
> `run'
>from /home/bruparel/exp/pizzeria-3/config/environment.rb:13
>from
> /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
>from
> /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `require'
>from
>
> /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in
> `require'
>from
>
> /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in
> `new_constants_in'
>from
>
> /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in
> `require'
>from
> /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/server.rb:84
>from
> /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
>from
> /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `require'
>from script/server:3
>
>
> Change it back to 2.1.2 and I am fine.  Is there something that is
> missing?  I do a rails -v and it shows that 2.3.2 is installed as shown
> below:
>
> brupa...@bcr-d810:~$ rails -v
> Rails 2.3.2
> brupa...@bcr-d810:~$
>
> Thanks for your time.
>
> Bharat


Hi, did you update your configs?

rake rails:update

-Conrad


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

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



[Rails] Rails 2.1.2 to 2.3.2 problems

2009-03-25 Thread Bharat Ruparel

I just installed Rails 2.3.2 and tried to upgrade my test app from
2.1.2.  After installing Rails 2.3.2, I simply changed the gem version
in my environment.rb file in config directory as shown below:

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION

The server refuses to start and I get the following stacktrace:

=> Booting Mongrel
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:416:in
`initialize_database': undefined method `configurations=' for
ActiveRecord::Base:Class (NoMethodError)
from
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:141:in
`process'
from
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in
`send'
from
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in
`run'
from /home/bruparel/exp/pizzeria-3/config/environment.rb:13
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in
`require'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in
`new_constants_in'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in
`require'
from
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/server.rb:84
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
from script/server:3


Change it back to 2.1.2 and I am fine.  Is there something that is
missing?  I do a rails -v and it shows that 2.3.2 is installed as shown
below:

brupa...@bcr-d810:~$ rails -v
Rails 2.3.2
brupa...@bcr-d810:~$

Thanks for your time.

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

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



[Rails] [JOBS] FOSS remote monitoring system is searching for Rails developers

2009-03-25 Thread koopmann.lenn...@googlemail.com

Hey everybody,

this is my second message regarding this topic to rubyonrails-talk. My
first message is from last year. There has been a lot of progress
since then so I am asking again:

ScopePort is a free open source remote monitoring system with a Rails
web interface. We are searching for Rails developers to release a beta
version as soon as possible. Ernesto joined the team after my last
message and I hope to find somebody as cool as him this time again.

Check out http://www.scopeport.org/ for more information about
ScopePort.

Here is an installation guide for the development version that comes
directly from our git repositories:
http://scopeport.org/guides/full_install_debian

Thank you for your time! You can reply to this message or contact me
directly at lenn...@scopeport.org

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



[Rails] curious how params, flash etc work in rails ?

2009-03-25 Thread wbsurf...@yahoo.com


 I am curious how stuff like params and flash work in the controller ?
Typically an instance variable is something like
@params, or maybe self.params. How does rails make params appear as if
it's an instance variable ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: question about creating a link to download

2009-03-25 Thread Jay Dev

This is an example.

I tried this below code but it blocks mongrel until the whole file is 
read which is over 500 MB.

  def download

send_data(open('http://mirrors.gigenet.com/ubuntu/intrepid/ubuntu-8.10-desktop-i386.iso').read,
:filename => 'ubuntu-8.10-desktop-i386.iso' ,
:type => 'application/force-download',
:disposition => 'attachment')
  end
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Cannot set date value

2009-03-25 Thread James Byrne

Frederick Cheung wrote:

> You could use ModelClass.column_names / ModelClass.columns_hash to see
> if an appropriately named column exists.

As far as I can tell from the code, that is pretty much what 
has_attribute? does.  However, upon reflection I realized that my 
approach did not accommodate virtual attributes.  So, I ended up with 
this:

  def attr_set_by_names(attr_names=[],param_hash={})
an = attr_names.to_ary
return self unless param_hash.kind_of?(Hash) && an.length > 0
an.each do |f|
  self.send("#{f}=", "#{param_hash[f]}") if 
self.method_exists?("#{f}=")
end
return self
  end

Which handles every setter method available to the class.

You assistance, as always, is greatly valued.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] What wrong?

2009-03-25 Thread Fresh Mix

I can't make this work:

http://groups.google.com/group/paperclip-plugin/browse_thread/thread/c8f58f0a4ef45d20/95e66f07c5722d96?lnk=gst&q=rename#95e66f07c5722d96


Where I have to place this code?

Paperclip::Attachment.interpolations[:random_key] = lambda do |
attachment, style|
   attachment.instance.random_key
end

I always get: undefined method `random_key'


Rais 2.3.2 and paperclip installed by gem
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Database Error?

2009-03-25 Thread Sean McGilvray
Yes that works.  How do I fix the problem of the correct environment not
loading?


Sean McGilvray & Sarena Byers
Director
Identity Theft Specialist
Pre-Paid Legal Service's, Inc. NYSE:PPD
Phone:  760-486-1019
smcgilv...@prepaidlegal.com
http://www.transferhome.net


On Wed, Mar 25, 2009 at 12:03 PM, Frederick Cheung <
frederick.che...@gmail.com> wrote:

>
>
>
> On Mar 25, 6:58 pm, Sean McGilvray  wrote:
> > No, my database.yml has the correct settings:
> >
> which implies that the correct environment isn't loaded. does
> RAILS_ENV=production rake db:load_csv_data
> work any better?
>
> Fred
> > production:
> >   adapter: mysql
> >   database: DB_NAME
> >   username: USER_NAME
> >   password: PASSWORD
> >   host: 127.0.0.1
> >
> > Sean McGilvray
> > Executive Director
> > Identity Theft Specialist
> > Pre-Paid Legal Service's, Inc. NYSE:PPD
> > Phone:  760-486-1019
> > smcgilv...@prepaidlegal.comhttp://www.transferhome.net
> >
> > On Wed, Mar 25, 2009 at 11:47 AM, Frederick Cheung <
> >
> > frederick.che...@gmail.com> wrote:
> >
> > > On Mar 25, 6:41 pm, Sean McGilvray  wrote:
> > > > Hello everyone,
> > > > I am getting this database connection error when I run a rake task or
> > > > when I try to send with ar_mailer.  My app works fine that I know of
> > > > but I went to import users into the database and this is what I get.
> >
> > > > rake db:load_csv_data --trace
> > > > (in /home/greatcar/gcp)
> > > > ** Invoke db:load_csv_data (first_time)
> > > > ** Invoke environment (first_time)
> > > > ** Execute environment
> > > > ** Execute db:load_csv_data
> > > > rake aborted!
> > > > Access denied for user 'root'@'localhost' (using password: NO)
> >
> > > Should it be connecting as root ?
> >
> > > 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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: MonkeyPatching ActiveRecord::Base class

2009-03-25 Thread Bharat Ruparel


"The difference with a file like the one you had is that there
isn't a top level constant one would naturally refer to)"

Thanks for the explanation Fred.  But I don't understand this.  Can you 
give me a simple example?

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

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



[Rails] Re: question about creating a link to download

2009-03-25 Thread Frederick Cheung



On Mar 25, 7:11 pm, Jay Dev  wrote:
> Thanks for the reply.
>
> The exe file is on another server.
>
OK. I was asking because if on the same server then things like X-Send-
File or X-Accel-Redirect work very nicely. You certainly could use net/
http to get the file and then send the response to the user although
for anything but the smallest of files you'll need to start sending
the data before you have grabbed all of it (because otherwise the user
will get bored or the browser will time you out) and I'm not sure
there's a nice way of doing that in rails.

Fred

> Thanks!
>
>
>
> Frederick Cheung wrote:
> > On Mar 25, 6:54 pm, Jay Dev  wrote:
> >> Hi Folks,
>
> >> I'm new to Rails and working on a project where after the user logs in
> >> they can click on a link to download an exe file ( say for example the
> >> file is athttp://test.com/test.exe). I want to keep the link to the exe
> >> file hidden. What are the best ways to implement this step.
>
> >> I was thinking about using the redirect to url but I have been getting
> >> an error saying that I cannot use two redirect's in a function.
>
> > redirect won't hide the url
>
> >> Also, I was thinking of using NET:HTTP to use http request but I have no
> >> idea how to implement this.
>
> > You could but it would block the mongrel for the entire time it took
> > to download the file.
>
> > What's not clear from your example is whether this file is on your
> > server or somewhere else.
>
> > Fred
>
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: can't update hidden attribute

2009-03-25 Thread Sacredceltic

I tried this :

in my controller :

@male = "M"
@female="F"

in my view :

page.replace_html 'recipient_gender', @male

It doesn't work either...

On Mar 25, 8:27 am, Sacredceltic  wrote:
> any hint ?
>
> Thank you
>
> On Mar 24, 3:57 pm, Sacredceltic  wrote:
>
> > Could you please explain how to do that ?
>
> > On Mar 24, 3:00 pm, Florian Dutey  wrote:
>
> > > It won't work anyway.
> > > In your really clean js code, you're replacing the content of
> > > "recipient_gender" by text ("f" or "m").
> > > So, you're replacing  by "f" or "m" and it
> > > won't be submitted to server.
>
> > > Use labels
>
> > > On 24 mar, 14:48, Sacredceltic  wrote:
>
> > > > Hi,
>
> > > > I want to be able to determine the gender of a person by clicking on a
> > > > picture (a boy and a girl's face), and it doesn't work. I can see the
> > > > F or G appear on the screen (when I don't want that actually because
> > > > it is supposed to be hidden...) but it doesn't save in the record.
>
> > > > Here is my "new.html.erb" view :
>
> > > > New member
>
> > > > <% form_for(@member) do |f| %>
> > > >   <%= f.error_messages %>
>
> > > >   
> > > >         <%= link_to_function(image_tag("Young M.jpg"), nil, :id => "M") 
> > > > do |
> > > > page|
> > > >                 page.replace_html 'recipient_gender', "M"
> > > >                 end  %>
>
> > > >         <%= link_to_function(image_tag("Young F.jpg"), nil, :id => "F") 
> > > > do |
> > > > page|
> > > >                 page.replace_html 'recipient_gender', "F"
> > > >                 end  %>
> > > >   
> > > >   
> > > >         <% f.hidden_field :gender %>
> > > >   
> > > >   
> > > >     Nickname: <%= f.text_field :nickname %>
> > > >   
> > > >   
> > > >     <%= f.submit "Create member" %>
> > > >   
> > > > <% end %>
>
> > > > And here are my members_controller corresponding actions :
>
> > > >   def new
> > > >         @member = current_user.members.build(params[:member])
> > > >   end
>
> > > >   def create
> > > >         @member = current_user.members.build(params[:member])
> > > >         if @member.save
> > > >                 flash[:notice] = 'member is created.'
> > > >                 redirect_to :action => 'index'
> > > >         else
> > > >         format.html { render :action => "new" }
> > > >         format.xml  { render :xml => @recipient.errors, :status
> > > > => :unprocessable_entity }
> > > >         end
> > > >   end
>
> > > > Thank you
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: question about creating a link to download

2009-03-25 Thread Jay Dev

Thanks for the reply.

The exe file is on another server.

Thanks!

Frederick Cheung wrote:
> On Mar 25, 6:54�pm, Jay Dev  wrote:
>> Hi Folks,
>>
>> I'm new to Rails and working on a project where after the user logs in
>> they can click on a link to download an exe file ( say for example the
>> file is athttp://test.com/test.exe). I want to keep the link to the exe
>> file hidden. What are the best ways to implement this step.
>>
>> I was thinking about using the redirect to url but I have been getting
>> an error saying that I cannot use two redirect's in a function.
>>
> 
> redirect won't hide the url
> 
>> Also, I was thinking of using NET:HTTP to use http request but I have no
>> idea how to implement this.
> 
> You could but it would block the mongrel for the entire time it took
> to download the file.
> 
> What's not clear from your example is whether this file is on your
> server or somewhere else.
> 
> 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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Database Error?

2009-03-25 Thread Frederick Cheung



On Mar 25, 6:58 pm, Sean McGilvray  wrote:
> No, my database.yml has the correct settings:
>
which implies that the correct environment isn't loaded. does
RAILS_ENV=production rake db:load_csv_data
work any better?

Fred
> production:
>   adapter: mysql
>   database: DB_NAME
>   username: USER_NAME
>   password: PASSWORD
>   host: 127.0.0.1
>
> Sean McGilvray
> Executive Director
> Identity Theft Specialist
> Pre-Paid Legal Service's, Inc. NYSE:PPD
> Phone:  760-486-1019
> smcgilv...@prepaidlegal.comhttp://www.transferhome.net
>
> On Wed, Mar 25, 2009 at 11:47 AM, Frederick Cheung <
>
> frederick.che...@gmail.com> wrote:
>
> > On Mar 25, 6:41 pm, Sean McGilvray  wrote:
> > > Hello everyone,
> > > I am getting this database connection error when I run a rake task or
> > > when I try to send with ar_mailer.  My app works fine that I know of
> > > but I went to import users into the database and this is what I get.
>
> > > rake db:load_csv_data --trace
> > > (in /home/greatcar/gcp)
> > > ** Invoke db:load_csv_data (first_time)
> > > ** Invoke environment (first_time)
> > > ** Execute environment
> > > ** Execute db:load_csv_data
> > > rake aborted!
> > > Access denied for user 'root'@'localhost' (using password: NO)
>
> > Should it be connecting as root ?
>
> > 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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: question about creating a link to download

2009-03-25 Thread Frederick Cheung



On Mar 25, 6:54 pm, Jay Dev  wrote:
> Hi Folks,
>
> I'm new to Rails and working on a project where after the user logs in
> they can click on a link to download an exe file ( say for example the
> file is athttp://test.com/test.exe). I want to keep the link to the exe
> file hidden. What are the best ways to implement this step.
>
> I was thinking about using the redirect to url but I have been getting
> an error saying that I cannot use two redirect's in a function.
>

redirect won't hide the url

> Also, I was thinking of using NET:HTTP to use http request but I have no
> idea how to implement this.

You could but it would block the mongrel for the entire time it took
to download the file.

What's not clear from your example is whether this file is on your
server or somewhere else.

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



[Rails] question about creating a link to download

2009-03-25 Thread Jay Dev

Hi Folks,

I'm new to Rails and working on a project where after the user logs in
they can click on a link to download an exe file ( say for example the
file is at http://test.com/test.exe). I want to keep the link to the exe
file hidden. What are the best ways to implement this step.

I was thinking about using the redirect to url but I have been getting
an error saying that I cannot use two redirect's in a function.

Also, I was thinking of using NET:HTTP to use http request but I have no
idea how to implement this.


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

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



[Rails] Re: More concise way to write aggregate query...

2009-03-25 Thread Neal L

I was reading about symbol to proc and thought there might be a use
here...  Yes, within() is a named_scope.

Thanks!

On Mar 25, 10:35 am, Rob Biedenharn 
wrote:
> On Mar 25, 2009, at 10:46 AM, Neal L wrote:
>
> > Hi all,
>
> > Just curious if anyone knows a cleaner way to write this query...
>
> > def payments_for(start_on, end_on)
> >    sum = 0
> >    self.leases.each { |lse|
> >        sum += lse.payments.within(start_on, end_on).sum(:amount)
> >    }
> >    sum
> > end
>
> > Thanks!
>
> NOTE: This is completely off the top of my head and quite possibly  
> contains bugs ;-)
>
> has_many :leases do
>    def payments_for(start_on, end_on)
>      select_value("SELECT SUM(payments.amount) FROM payments INNER  
> JOIN leases ON leases.id = payments.lease_id WHERE  
> #{proxy_owner.class.send(:sanitize_sql, ['payments.paid_on BETWEEN ?  
> AND ?  AND leases.some_parent_id = ?', start_on, end_on,  
> proxy_owner.id])}")
>    end
> end
>
> Actually, I realize that I'm thinking of 'more performant' rather than  
> 'cleaner' by shifting some work to the database.  Since I don't know  
> where the #within method comes from (named_scope perhaps?), I really  
> can't say too much. Your solution is actually quite clean. What  
> prompted you to ask the question?
>
> -Rob
>
> Rob Biedenharn          http://agileconsultingllc.com
> r...@agileconsultingllc.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: ActiveRecord: Nested :include erroneous behavior

2009-03-25 Thread akshay rawat
Yup, it passes without the :order option, indicating that there is a problem
with the join based mechanism. Thanks

On Wed, Mar 25, 2009 at 2:49 PM, Frederick Cheung <
frederick.che...@gmail.com> wrote:

>
>
>
> On Mar 25, 6:39 pm, akshay rawat  wrote:
> > Thanks for looking at it.A one file test -http://pastie.org/426840
> >
> > Another thing I saw was that the that test passes when :include is
> replaced
> > with :joins.
>
> Not surprising - in that case the association isn't eager loaded at
> all. If it passes without the order clause then you've narrowed it
> down to the joins based include mechanism.
>
> Fred
> >
> > On Wed, Mar 25, 2009 at 2:05 PM, Frederick Cheung <
> >
> > frederick.che...@gmail.com> wrote:
> >
> > > On Mar 25, 1:45 pm, akshay.ra...@gmail.com wrote:
> > > > Bad paste. The problem again. Looks like it is a problem only when
> there
> > > is
> > > > a has_one relationship.
> >
> > > Do you need all these models/associations or is there a small test
> > > case that fails ?
> >
> > > Fred
> > > > class Book < ActiveRecord::Base
> > > > has_one :distributor
> > > > end
> >
> > > > class Distributor < ActiveRecord::Base
> > > > belongs_to :book
> > > > has_many :agents
> > > > end
> >
> > > > class Agent < ActiveRecord::Base
> > > > belongs_to :distributor
> > > > has_many :shops
> > > > end
> >
> > > > class Shop < ActiveRecord::Base
> > > > belongs_to :agent
> > > > end
> >
> > > > Schema -http://pastie.org/426261
> >
> > > > def test_should_load_avatars
> > > > shop_1= Shop.create!
> > > > shop_2= Shop.create!
> > > > book= Book.create!(:distributor => Distributor.create!(:agents=>
> > > > [Agent.create!(:shops => [shop_1, shop_2])]))
> >
> > > > loaded_version = Book.find(book.id, :include => [:distributor =>
> > > {:agents
> > > > => :shops}], :order => 'shops.id')
> >
> > > > assert(loaded_version.distributor.agents.first.shops.size == 2)
> > > > #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD OF 2
> > > > end
> >
> > > > This fails on Rails 2.2.2.
> > > > Any help on this would be much appreciated,
> > > > Akshay
> >
> > > > On Mar 25, 2009 4:04am, Frederick Cheung  >
> > > wrote:
> >
> > > > > On Mar 25, 5:19 am, Akshay Rawat akshay.ra...@gmail.com> wrote:
> > > > > > def test_should_load_avatars
> > > > > > shop_1= Shop.create!
> > > > > > shop_2= Shop.create!
> > > > > > book= Book.create!(:distributors =>
> [Distributor.create!(:agents=>
> > > > > > [Agent.create!(:shops => [shop_2, shop_2])])])
> >
> > > > > > loaded_version = Book.find(book.id, :include => [:distributors
> =>
> > > > > > {:agents => :shops}], :order => 'shops.id')
> >
> > > > > > assert(loaded_version.distributors.first.agents.first.shops.size
> ==
> > > > > > 2) #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD OF 2
> > > > > > end
> >
> > > > > > On some investigation, I found that the query fired was correct,
> but
> > > > > > Rails was unable to instantiate the 'shops' collection properly.
> >
> > > > > The problem is not to do with the nested-ness of the includes but
> > > > > because you have an agent with the same shop twice (the line in
> > > > > question that removes duplicates is
> > > > >
> http://github.com/rails/rails/blob/f97832b1e4406a76d268a96b521d2297ad.
> > > ..
> > > > > Fred
> > > > > > Any help on this issue would be appreciated.
> >
> > > > > > Thanks
> >
>

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



[Rails] Re: I18n + ActionMailer = conflict ?

2009-03-25 Thread Tom Ha

Ok, figured it out:

In a Mailer model, translations can not be accessed using the shortcut:

  t(...)

You have to use it this way:

  I18n.t(...)
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Database Error?

2009-03-25 Thread Sean McGilvray
No, my database.yml has the correct settings:

production:
  adapter: mysql
  database: DB_NAME
  username: USER_NAME
  password: PASSWORD
  host: 127.0.0.1


Sean McGilvray
Executive Director
Identity Theft Specialist
Pre-Paid Legal Service's, Inc. NYSE:PPD
Phone:  760-486-1019
smcgilv...@prepaidlegal.com
http://www.transferhome.net


On Wed, Mar 25, 2009 at 11:47 AM, Frederick Cheung <
frederick.che...@gmail.com> wrote:

>
>
>
> On Mar 25, 6:41 pm, Sean McGilvray  wrote:
> > Hello everyone,
> > I am getting this database connection error when I run a rake task or
> > when I try to send with ar_mailer.  My app works fine that I know of
> > but I went to import users into the database and this is what I get.
> >
> > rake db:load_csv_data --trace
> > (in /home/greatcar/gcp)
> > ** Invoke db:load_csv_data (first_time)
> > ** Invoke environment (first_time)
> > ** Execute environment
> > ** Execute db:load_csv_data
> > rake aborted!
> > Access denied for user 'root'@'localhost' (using password: NO)
>
> Should it be connecting as root ?
>
> 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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Database Error?

2009-03-25 Thread Frederick Cheung



On Mar 25, 6:41 pm, Sean McGilvray  wrote:
> Hello everyone,
> I am getting this database connection error when I run a rake task or
> when I try to send with ar_mailer.  My app works fine that I know of
> but I went to import users into the database and this is what I get.
>
> rake db:load_csv_data --trace
> (in /home/greatcar/gcp)
> ** Invoke db:load_csv_data (first_time)
> ** Invoke environment (first_time)
> ** Execute environment
> ** Execute db:load_csv_data
> rake aborted!
> Access denied for user 'root'@'localhost' (using password: NO)

Should it be connecting as root ?

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



[Rails] Re: ActiveRecord: Nested :include erroneous behavior

2009-03-25 Thread akshay rawat
Thanks for looking at it.A one file test - http://pastie.org/426840

Another thing I saw was that the that test passes when :include is replaced
with :joins.

On Wed, Mar 25, 2009 at 2:05 PM, Frederick Cheung <
frederick.che...@gmail.com> wrote:

>
>
>
> On Mar 25, 1:45 pm, akshay.ra...@gmail.com wrote:
> > Bad paste. The problem again. Looks like it is a problem only when there
> is
> > a has_one relationship.
> >
> Do you need all these models/associations or is there a small test
> case that fails ?
>
> Fred
> > class Book < ActiveRecord::Base
> > has_one :distributor
> > end
> >
> > class Distributor < ActiveRecord::Base
> > belongs_to :book
> > has_many :agents
> > end
> >
> > class Agent < ActiveRecord::Base
> > belongs_to :distributor
> > has_many :shops
> > end
> >
> > class Shop < ActiveRecord::Base
> > belongs_to :agent
> > end
> >
> > Schema -http://pastie.org/426261
> >
> > def test_should_load_avatars
> > shop_1= Shop.create!
> > shop_2= Shop.create!
> > book= Book.create!(:distributor => Distributor.create!(:agents=>
> > [Agent.create!(:shops => [shop_1, shop_2])]))
> >
> > loaded_version = Book.find(book.id, :include => [:distributor =>
> {:agents
> > => :shops}], :order => 'shops.id')
> >
> > assert(loaded_version.distributor.agents.first.shops.size == 2)
> > #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD OF 2
> > end
> >
> > This fails on Rails 2.2.2.
> > Any help on this would be much appreciated,
> > Akshay
> >
> > On Mar 25, 2009 4:04am, Frederick Cheung 
> wrote:
> >
> > > On Mar 25, 5:19 am, Akshay Rawat akshay.ra...@gmail.com> wrote:
> > > > def test_should_load_avatars
> > > > shop_1= Shop.create!
> > > > shop_2= Shop.create!
> > > > book= Book.create!(:distributors => [Distributor.create!(:agents=>
> > > > [Agent.create!(:shops => [shop_2, shop_2])])])
> >
> > > > loaded_version = Book.find(book.id, :include => [:distributors =>
> > > > {:agents => :shops}], :order => 'shops.id')
> >
> > > > assert(loaded_version.distributors.first.agents.first.shops.size ==
> > > > 2) #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD OF 2
> > > > end
> >
> > > > On some investigation, I found that the query fired was correct, but
> > > > Rails was unable to instantiate the 'shops' collection properly.
> >
> > > The problem is not to do with the nested-ness of the includes but
> > > because you have an agent with the same shop twice (the line in
> > > question that removes duplicates is
> > >http://github.com/rails/rails/blob/f97832b1e4406a76d268a96b521d2297ad.
> ..
> > > Fred
> > > > Any help on this issue would be appreciated.
> >
> > > > Thanks
> >
>

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



[Rails] Re: ActiveRecord: Nested :include erroneous behavior

2009-03-25 Thread Frederick Cheung



On Mar 25, 6:39 pm, akshay rawat  wrote:
> Thanks for looking at it.A one file test -http://pastie.org/426840
>
> Another thing I saw was that the that test passes when :include is replaced
> with :joins.

Not surprising - in that case the association isn't eager loaded at
all. If it passes without the order clause then you've narrowed it
down to the joins based include mechanism.

Fred
>
> On Wed, Mar 25, 2009 at 2:05 PM, Frederick Cheung <
>
> frederick.che...@gmail.com> wrote:
>
> > On Mar 25, 1:45 pm, akshay.ra...@gmail.com wrote:
> > > Bad paste. The problem again. Looks like it is a problem only when there
> > is
> > > a has_one relationship.
>
> > Do you need all these models/associations or is there a small test
> > case that fails ?
>
> > Fred
> > > class Book < ActiveRecord::Base
> > > has_one :distributor
> > > end
>
> > > class Distributor < ActiveRecord::Base
> > > belongs_to :book
> > > has_many :agents
> > > end
>
> > > class Agent < ActiveRecord::Base
> > > belongs_to :distributor
> > > has_many :shops
> > > end
>
> > > class Shop < ActiveRecord::Base
> > > belongs_to :agent
> > > end
>
> > > Schema -http://pastie.org/426261
>
> > > def test_should_load_avatars
> > > shop_1= Shop.create!
> > > shop_2= Shop.create!
> > > book= Book.create!(:distributor => Distributor.create!(:agents=>
> > > [Agent.create!(:shops => [shop_1, shop_2])]))
>
> > > loaded_version = Book.find(book.id, :include => [:distributor =>
> > {:agents
> > > => :shops}], :order => 'shops.id')
>
> > > assert(loaded_version.distributor.agents.first.shops.size == 2)
> > > #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD OF 2
> > > end
>
> > > This fails on Rails 2.2.2.
> > > Any help on this would be much appreciated,
> > > Akshay
>
> > > On Mar 25, 2009 4:04am, Frederick Cheung 
> > wrote:
>
> > > > On Mar 25, 5:19 am, Akshay Rawat akshay.ra...@gmail.com> wrote:
> > > > > def test_should_load_avatars
> > > > > shop_1= Shop.create!
> > > > > shop_2= Shop.create!
> > > > > book= Book.create!(:distributors => [Distributor.create!(:agents=>
> > > > > [Agent.create!(:shops => [shop_2, shop_2])])])
>
> > > > > loaded_version = Book.find(book.id, :include => [:distributors =>
> > > > > {:agents => :shops}], :order => 'shops.id')
>
> > > > > assert(loaded_version.distributors.first.agents.first.shops.size ==
> > > > > 2) #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD OF 2
> > > > > end
>
> > > > > On some investigation, I found that the query fired was correct, but
> > > > > Rails was unable to instantiate the 'shops' collection properly.
>
> > > > The problem is not to do with the nested-ness of the includes but
> > > > because you have an agent with the same shop twice (the line in
> > > > question that removes duplicates is
> > > >http://github.com/rails/rails/blob/f97832b1e4406a76d268a96b521d2297ad.
> > ..
> > > > Fred
> > > > > Any help on this issue would be appreciated.
>
> > > > > Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] I18n + ActionMailer = conflict ?

2009-03-25 Thread Tom Ha

Hi there,

can anybody tell me why I get the error message:

  "undefined method 't' for #"

... when I call the following Mailer?

=
class Mailer < ActionMailer::Base

  def signup_notification(user)
@recipients  = "#{user.email}"
@from= APP_CONFIG['mail']['sender']

@subject = "#{APP_CONFIG['settings']['name']} - "
@subject+= "#{ t('.activate_new_account') }."

@body[:user] = user
@body[:url]  =
"http://#{APP_CONFIG['settings']['domain']}/activate/#{user.activation_code}"
@sent_on = Time.now
  end

end
=

(See the translation in the 2 "@subject" lines)

Does I18n have a problem with ActionMailer or what am I missing?

Thanks a bunch for any hint!
Tom
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Database Error?

2009-03-25 Thread Sean McGilvray

Hello everyone,
I am getting this database connection error when I run a rake task or
when I try to send with ar_mailer.  My app works fine that I know of
but I went to import users into the database and this is what I get.

rake db:load_csv_data --trace
(in /home/greatcar/gcp)
** Invoke db:load_csv_data (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:load_csv_data
rake aborted!
Access denied for user 'root'@'localhost' (using password: NO)
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/mysql_adapter.rb:548:in `real_connect'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/mysql_adapter.rb:548:in `connect'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/mysql_adapter.rb:198:in `initialize'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/mysql_adapter.rb:74:in `new'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/mysql_adapter.rb:74:in `mysql_connection'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/abstract/connection_pool.rb:223:in `send'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/abstract/connection_pool.rb:223:in
`new_connection'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/abstract/connection_pool.rb:245:in
`checkout_new_connection'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/abstract/connection_pool.rb:188:in `checkout'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/abstract/connection_pool.rb:184:in `loop'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/abstract/connection_pool.rb:184:in `checkout'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/abstract/connection_pool.rb:183:in `checkout'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/abstract/connection_pool.rb:98:in `connection'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/abstract/connection_pool.rb:326:in
`retrieve_connection'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/abstract/connection_specification.rb:121:in
`retrieve_connection'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/abstract/connection_specification.rb:113:in
`connection'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
base.rb:1220:in `columns'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
base.rb:2839:in `attributes_from_column_definition_without_lock'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
locking/optimistic.rb:55:in `attributes_from_column_definition'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
base.rb:2279:in `initialize'
/home/greatcar/gcp/lib/tasks/import.rake:9:in `new'
/home/greatcar/gcp/lib/tasks/import.rake:9
/usr/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/faster_csv.rb:1514:in
`each'
/usr/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/faster_csv.rb:1017:in
`foreach'
/usr/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/faster_csv.rb:1191:in
`open'
/usr/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/faster_csv.rb:1016:in
`foreach'
/home/greatcar/gcp/lib/tasks/import.rake:8
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in
`invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in
`invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in
`invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in
`standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1991:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1970:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in
`standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1967:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/bin/rake:31
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19

Thanks for the help,

Sean McGilvray
--~--~-~--~~~---~--~~
You received this message because you a

[Rails] Re: Problem with functional test

2009-03-25 Thread Phlip

Pietia wrote:

> class Admin::ProjectsControllerTest < ActiveSupport::TestCase

Shouldn't that be like ActiveController::TestCase

?


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



[Rails] Re: MonkeyPatching ActiveRecord::Base class

2009-03-25 Thread Frederick Cheung


On 25 Mar 2009, at 16:11, Bharat Ruparel wrote:
>
> Question is: what is the significance of the "lib" directory then in a
> Rails environment?  If it just gets added in the Rails load path and
> nothing else then it leaves me scratching my head.  Either don't put  
> in
> the load path automatcially or if we do then load whatever is in there
> automatically too.  Don't you think Rails is at odds with itself here?
>

Except for the production mode stuff, nothing gets loaded  
automatically (the const_missing hook can make it seem that way  
though. The difference with a file like the one you had is that there  
isn't a top level constant one would naturally refer to)

Fred

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


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



[Rails] Re: ActiveRecord: Nested :include erroneous behavior

2009-03-25 Thread Frederick Cheung



On Mar 25, 1:45 pm, akshay.ra...@gmail.com wrote:
> Bad paste. The problem again. Looks like it is a problem only when there is  
> a has_one relationship.
>
Do you need all these models/associations or is there a small test
case that fails ?

Fred
> class Book < ActiveRecord::Base
> has_one :distributor
> end
>
> class Distributor < ActiveRecord::Base
> belongs_to :book
> has_many :agents
> end
>
> class Agent < ActiveRecord::Base
> belongs_to :distributor
> has_many :shops
> end
>
> class Shop < ActiveRecord::Base
> belongs_to :agent
> end
>
> Schema -http://pastie.org/426261
>
> def test_should_load_avatars
> shop_1= Shop.create!
> shop_2= Shop.create!
> book= Book.create!(:distributor => Distributor.create!(:agents=>  
> [Agent.create!(:shops => [shop_1, shop_2])]))
>
> loaded_version = Book.find(book.id, :include => [:distributor => {:agents  
> => :shops}], :order => 'shops.id')
>
> assert(loaded_version.distributor.agents.first.shops.size == 2)
> #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD OF 2
> end
>
> This fails on Rails 2.2.2.
> Any help on this would be much appreciated,
> Akshay
>
> On Mar 25, 2009 4:04am, Frederick Cheung  wrote:
>
> > On Mar 25, 5:19 am, Akshay Rawat akshay.ra...@gmail.com> wrote:
> > > def test_should_load_avatars
> > > shop_1= Shop.create!
> > > shop_2= Shop.create!
> > > book= Book.create!(:distributors => [Distributor.create!(:agents=>
> > > [Agent.create!(:shops => [shop_2, shop_2])])])
>
> > > loaded_version = Book.find(book.id, :include => [:distributors =>
> > > {:agents => :shops}], :order => 'shops.id')
>
> > > assert(loaded_version.distributors.first.agents.first.shops.size ==
> > > 2) #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD OF 2
> > > end
>
> > > On some investigation, I found that the query fired was correct, but
> > > Rails was unable to instantiate the 'shops' collection properly.
>
> > The problem is not to do with the nested-ness of the includes but
> > because you have an agent with the same shop twice (the line in
> > question that removes duplicates is
> >http://github.com/rails/rails/blob/f97832b1e4406a76d268a96b521d2297ad...
> > Fred
> > > Any help on this issue would be appreciated.
>
> > > Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Few Questions about form_for_remote

2009-03-25 Thread Greg Donald

On Wed, Mar 25, 2009 at 12:22 PM, tashfeen.ekram
 wrote:
> 1. if i use the :update param on form_for_remote can I mix javascript
> and ruby? i want to use the selector offered by prototype but pass in
> the parameters from a ruby expression

You can, but in some case you may find an RJS template easier to deal
with, especially if you have complex logic after the form post.  I
usually just use :loading and :completed in my form tag and then do my
update using replace_html instead of :update.

> 2. Can you use RJS commands for  :loading ? seems like not :(

I've never tried, but yeah I think not also.

> 3. for the button:
>
> <%= f.submit "Update", :disable_with => "Please wait..." %>
>
> I would like it to be disabled until the request ir returned however
> using the above only disables it momentrily whil it is sending the
> request and then it can be pressed again even before the sever
> responds.

That sounds like a bug to me.


-- 
Greg Donald
http://destiney.com/

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



[Rails] Re: Problem with functional test

2009-03-25 Thread Frederick Cheung


On 25 Mar 2009, at 16:37, Pietia wrote:

>
> Hi
>
> I have upgraded to 2.3.2 and changed updated everything inside
> myproject :
>
>
> This is my functional TEST :
>
> require 'test_helper'
>
> class Admin::ProjectsControllerTest < ActiveSupport::TestCase

You should have changed that to ActionController::TestCase.

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



[Rails] Re: advanced search for a model (including keywords)

2009-03-25 Thread Freddy Andersen

I personally had many issues trying to use Ferret and would recommend
Sphinx with thinking sphinx plugin.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Few Questions about form_for_remote

2009-03-25 Thread Frederick Cheung



On Mar 25, 5:22 pm, "tashfeen.ekram"  wrote:
> Still learning some stuff so forgive the newbie type questions.
>
> 1. if i use the :update param on form_for_remote can I mix javascript
> and ruby? i want to use the selector offered by prototype but pass in
> the parameters from a ruby expression
>
> <% form_remote_for(userdrug, :loading => "$('').show();" + "alert
> ('hi');" do |f| %>
>
> I would basically like in where  is to have an ruby expression
> like object.id
That's a ruby string, you can put whatever ruby expression you want
(of course this is evaluated when the template is rendered, not when
you press submit

>
> 2. Can you use RJS commands for  :loading ? seems like not :(
>
You can via update_page (an ajax responder is often cleaner though).
You'll write better JS once you get over RJS

> 3. for the button:
>
> <%= f.submit "Update", :disable_with => "Please wait..." %>
>
> I would like it to be disabled until the request ir returned however
> using the above only disables it momentrily whil it is sending the
> request and then it can be pressed again even before the sever
> responds.
>
Personally I would do that via an ajax callback. The code for submit
looks it would undisable the button if the onsubmit returns false
(which the one remote_form_for will do since it's preventing the
browser from submitting the form normally)

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



[Rails] Re: Few Questions about form_for_remote

2009-03-25 Thread tashfeen.ekram

figured out answer to the first one:

<% form_remote_for(userdrug, :loading => "$('" + user.id + "').show
();" + "alert('hi');" do |f| %>



On Mar 25, 1:22 pm, "tashfeen.ekram"  wrote:
> Still learning some stuff so forgive the newbie type questions.
>
> 1. if i use the :update param on form_for_remote can I mix javascript
> and ruby? i want to use the selector offered by prototype but pass in
> the parameters from a ruby expression
>
> <% form_remote_for(userdrug, :loading => "$('').show();" + "alert
> ('hi');" do |f| %>
>
> I would basically like in where  is to have an ruby expression
> like object.id
>
> 2. Can you use RJS commands for  :loading ? seems like not :(
>
> 3. for the button:
>
> <%= f.submit "Update", :disable_with => "Please wait..." %>
>
> I would like it to be disabled until the request ir returned however
> using the above only disables it momentrily whil it is sending the
> request and then it can be pressed again even before the sever
> responds.
>
> Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Problem with functional test

2009-03-25 Thread Greg Donald

On Wed, Mar 25, 2009 at 11:37 AM, Pietia  wrote:
> I have upgraded to 2.3.2 and changed updated everything inside
> myproject :
>
> This is my functional TEST :
>
> require 'test_helper'
>
> class Admin::ProjectsControllerTest < ActiveSupport::TestCase

You need "fixtures :projects" here.

>  def test_get_index
>    get :index
>    assert_response :success
>    assert_not_nil assigns(:projects)
>  end
>
> end


-- 
Greg Donald
http://destiney.com/

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



[Rails] Re: ActiveRecord: Nested :include erroneous behavior

2009-03-25 Thread akshay rawat
Created a ticket for this issue at -
http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2341

On Wed, Mar 25, 2009 at 9:45 AM,  wrote:

> Bad paste. The problem again. Looks like it is a problem only when there is
> a has_one relationship.
>
> class Book < ActiveRecord::Base
> has_one :distributor
> end
>
> class Distributor < ActiveRecord::Base
> belongs_to :book
> has_many :agents
> end
>
> class Agent < ActiveRecord::Base
> belongs_to :distributor
> has_many :shops
> end
>
> class Shop < ActiveRecord::Base
> belongs_to :agent
> end
>
> Schema - http://pastie.org/426261
>
> def test_should_load_avatars
> shop_1= Shop.create!
> shop_2= Shop.create!
> book= Book.create!(:distributor => Distributor.create!(:agents=>
> [Agent.create!(:shops => [shop_1, shop_2])]))
>
>
> loaded_version = Book.find(book.id, :include => [:distributor => {:agents
> => :shops}], :order => 'shops.id')
>
> assert(loaded_version.distributor.agents.first.shops.size == 2)
> #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD OF 2
> end
>
> This fails on Rails 2.2.2.
> Any help on this would be much appreciated,
> Akshay
>
> On Mar 25, 2009 4:04am, Frederick Cheung 
> wrote:
> >
> >
> >
> >
> >
> >
> > On Mar 25, 5:19 am, Akshay Rawat akshay.ra...@gmail.com> wrote:
> >
> > > def test_should_load_avatars
> >
> > >   shop_1= Shop.create!
> >
> > >   shop_2= Shop.create!
> >
> > >   book= Book.create!(:distributors => [Distributor.create!(:agents=>
> >
> > > [Agent.create!(:shops => [shop_2, shop_2])])])
> >
> > >
> >
> > >   loaded_version = Book.find(book.id, :include => [:distributors =>
> >
> > > {:agents => :shops}], :order => 'shops.id')
> >
> > >
> >
> > >   assert(loaded_version.distributors.first.agents.first.shops.size ==
> >
> > > 2)   #THIS ASSERTION FAILS WITH SHOPS.SIZE BEING 1, INSTEAD OF 2
> >
> > > end
> >
> > >
> >
> > > On some investigation, I found that the query fired was correct, but
> >
> > > Rails was unable to instantiate the 'shops' collection properly.
> >
> > >
> >
> > The problem is not to do with the nested-ness of the includes but
> >
> > because you have an agent with the same shop twice (the line in
> >
> > question that removes duplicates is
> >
> >
> http://github.com/rails/rails/blob/f97832b1e4406a76d268a96b521d2297adec0ae3/activerecord/lib/active_record/associations.rb#L1781
> >
> >
> >
> > Fred
> >
> >
> >
> > > Any help on this issue would be appreciated.
> >
> > >
> >
> > > Thanks
> >
> > > >
> >
> >
>

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



[Rails] Few Questions about form_for_remote

2009-03-25 Thread tashfeen.ekram

Still learning some stuff so forgive the newbie type questions.

1. if i use the :update param on form_for_remote can I mix javascript
and ruby? i want to use the selector offered by prototype but pass in
the parameters from a ruby expression

<% form_remote_for(userdrug, :loading => "$('').show();" + "alert
('hi');" do |f| %>

I would basically like in where  is to have an ruby expression
like object.id

2. Can you use RJS commands for  :loading ? seems like not :(

3. for the button:

<%= f.submit "Update", :disable_with => "Please wait..." %>

I would like it to be disabled until the request ir returned however
using the above only disables it momentrily whil it is sending the
request and then it can be pressed again even before the sever
responds.

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



[Rails] Re: no such file to load -- config/environment - Apache2 & Passenger 2.1.1

2009-03-25 Thread Charles Johnson
On Wed, Mar 25, 2009 at 9:40 AM, doron  wrote:

>
> try here:
> http://blog.scopeport.org/ruby-on-rails/phusion-passenger-error-file-directory-nonexistent/
>
>
> Basti כתב:
> > Hi,
> > i recently started using Ruby and Ruby on Rails. For Development i'm
> > using RadRails and InstantRails on my local Windows machine.
> >
> > Atm i'm trying to get a basic application running on Ubuntu Server
> > 8.10 with Apache 2.2.9 & Phusion_Passenger 2.1.1.
> > Frist i tried to get just the app-sceleton generate by RadRails to
> > work (which worked fine on InstantRails) and the i tried the same with
> > Typo(blog).
> >
> > In both cases i recieve the following error:
> >
> > no such file to load -- config/environment
> >
>
Change the owner and group of the environment.rb file to the user and group
of your apache2 instance (probably www-data). See if that helps.
Cheers--

Charles

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



[Rails] Re: advanced search for a model (including keywords)

2009-03-25 Thread Eric

It's really basic search you're looking for. 100,000 records is not
that many, use acts_as_ferret with a local index and you'll be fine
for quite a while.

On Mar 25, 7:25 am, aupayo  wrote:
> Hello,
>
> I am new in rails and I am working in an application which requires
> advanced search.
> I have a model called Item which has various attributes like "weight",
> "price", "category", "age"...and then it has some "keywords",
> describing the Item.
>
> I would like to implement an advanced search where the users can
> search Items using the attributes that they want.
>
> After googling some time, I found that:
>
> - acts_as_taggable could be useful for the "keywords" attribute.
> - acts_as_ferret could be useful for searching the tags (I would need
> to search for multiple tags in the same query, include some fuzzy
> search...)
> - Searchlogic would be very useful to implement the search with all
> the attributes, but I am not sure if it can cope with the
> acts_as_taggable plugin, or if I should implement the keywords just
> using a String attribute, or how to do it.
>
> Well, I know I have a lot of work to do, but I would really appreciate
> if someone could give me some hints in order to point the direction in
> which I should work. Which is the best way (or simplest) in your
> opinion to implement this search?
>
> The application will have to deal with "many" records (lets say
> 100.000), so I would also appreciate receiving some comments regarding
> speed...however it doesn't have to be the faster app in the world, in
> this moment I prefer an easier development and I'll improve the app in
> the future if needed.
>
> Thanks a lot for your help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Problem with functional test

2009-03-25 Thread Pietia

Hi

I have upgraded to 2.3.2 and changed updated everything inside
myproject :


This is my functional TEST :

require 'test_helper'

class Admin::ProjectsControllerTest < ActiveSupport::TestCase

  def test_get_index
get :index
assert_response :success
assert_not_nil assigns(:projects)
  end

end


This is my console :

s128:test pietia$ ruby functional/admin/projects_controller_test.rb
Loaded suite functional/admin/projects_controller_test
Started
E
Finished in 0.119872 seconds.

  1) Error:
test_get_index(Admin::ProjectsControllerTest):
NoMethodError: undefined method `get' for
#
functional/admin/projects_controller_test.rb:6:in `test_get_index'

1 tests, 0 assertions, 0 failures, 1 errors


Project_controller have index method and it works in browser.

I dont have idea how to solve it, google also don't give me any
answers.


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



[Rails] Re: Linking a model to a specific user - RESTful Authenticat

2009-03-25 Thread Mark Mr

No you should use both. Restful authentication creates users and ACL 
tells the program what parts of the website those users (or non-users) 
can access. The ACL is really simple, it's just a matter of putting 
those ACL functions in each model.

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

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



[Rails] Re: Passenger vs Mongrel

2009-03-25 Thread Aníbal Rojas

Power One,

   The answer is 'it depends', if you are familiar with Apache,
already have it running and feel comfortable managing it Passenger is
a really good option, also it should do a great job if you are
planning to have a bunch of small apps. If you are low on resources
and need nothing but run a rails app mongrel or thing should do the
job for you, usually with a small, fast, efficient web server in the
front end as Nginx.

   I would recommend posting it to the Rails Deployment Group:

   http://groups.google.com/group/rubyonrails-deployment/about

   Best regards,

--
Aníbal Rojas@anibalrojas
http://hasmanydevelopers.com
http://rubycorner.com
http://en.anibal.rojas.com.ve

On Mar 26, 4:24 am, Power One 
wrote:
> I have a simple question guys!  Is passenger for deploying RoR apps vs
> mongrel, which one is better?  I saw how easy it's to deploy passenger,
> but I wonder is it still relevant to current rails (2.3.2) and ruby
> 1.8.7 or 1.9?
>
> I'm very new to RoR environment.  I'm more familiar with how to setup
> LAMP (Linux/Apache/MySQL/PHP).  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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: 404 error in route

2009-03-25 Thread Hassan Schroeder

On Tue, Mar 24, 2009 at 6:56 AM, johnwum...@gmail.com
 wrote:

> I get a very strang error when I deploy my rails 2.2.2 application to
> the server. The application works when I start it with script/server.
> but when I deploy the app to rails host server (I think it runs with
> lighttpd or something).

"think"?? not a good sign.

>  I can only acess the page with first level 
> URL
> (i.e., http://test6.123server.cn/users). But I can't access the second
> level URL (i.e., http://test6.123server.cn/users/1  
> http://test6.123server.cn/users/new).
> I get http 404 error which indicate the page can't be found. I guess
> there is something wrong with the route. But my route is very simple
> (attached below).

Have you run `rake routes` and compared that to what's showing up
in your server access and rails app logs?

That's what I'd do for starters :-)
-- 
Hassan Schroeder  hassan.schroe...@gmail.com

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



  1   2   >