[Rails] upgraing rails 1.2.5 to 2.3.5

2010-05-03 Thread Sathish Thandavan
while upgrading rails 1.2.5 to 2.3.5 i am getting missing template
error...after i changing .rhtml to .html.erb
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Ruby CAS & Restful Authentication Plugin

2010-05-03 Thread D
Hi all,
I have installed Ruby CAS server and my application has got a  simple
Restful Authentication Plugin for  User Management.I would to like
experiment my application by providing a Central Authentication since
I am using PHP app for blogging.And I am using 
http://github.com/gunark/rubycas-client
as the Ruby CAS client .

Does Ruby CAS server supports Restful Authentication Mechanism for CAS
to implement SSO (Single Sign On) ? I am getting CAS login Screen
after doing the preliminary setups.

Any help would be appreciated.

Thanks in Advance
D

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



Re: [Rails] Couldn’t get bounced email id in “Fa ilure delivery notice”

2010-05-03 Thread Mikel Lindsaar
On 4, May 2010, at 4 May 15:42, sathishkumar wrote:
> Question: Can you please anyone suggest me, how to find out the email-id 
> which is failed to deliver / invalid one from that bounced email notice.

The most fool proof way to do this is to get the message-id of the mail you 
have sent, and store that somewhere against the user you sent to.

Then when you get the bounce message, dig out the message-id and then lookup 
the message-id in your table to find the user.

Mikel Lindsaar
http://rubyx.com/
http://lindsaar.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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Couldn’t get bounced email id in “Failur e delivery notice”

2010-05-03 Thread sathishkumar
Hi All,

We have an email receiver component to receive mails. We couldn’t get the
bounced email id from “failure delivery notice” email.

Scenario:  In email receiver,  we need to process the bounced emails
separately as in it needs to be tracked and take a action to stop sending
emails to particular email-id if it is hard bounce, and if it’s a soft
bounce, we have to make a count for it and take action according to the
number failures.

Problem: We have found/ differentiated the bounced emails from regular
emails. But we need to find out which email-id has been failed to deliver /
invalid one. All email service providers are mentioning the email id in body
content (“Failure delivery notice”) in different format.

Question: Can you please anyone suggest me, how to find out the email-id
which is failed to deliver / invalid one from that bounced email notice.

Looking for a your suggestions / comments eagerly,

Thanks in Advance,

Regards,
Sathish Kumar Sadhasivam,
E-mail : srssathishku...@gmail.com
Mobile : +91 98948 81242
Skype : ssathishkumar22
Gtalk : sathishjob

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



Re: [Rails] What version of Ruby does/will Rails 3 require?

2010-05-03 Thread Conrad Taylor



Sent from my iPhone

On May 3, 2010, at 9:32 PM, Matt Slay  wrote:


What version of Ruby does or will Rails 3 require?


Matt, Rails 3 requires Ruby 1.8.7 at the absolute minimum but works  
best with Ruby 1.9.2.


Good luck,

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




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



Re: [Rails] Re: rendering images dynamically

2010-05-03 Thread Anand Ramanathan
Thanks, Rob

I finally got it working by using periodically_call_remote in conjunction
with the spawn plugin which runs the long process in parallel.

Thanks for your help!
Anand

On Mon, May 3, 2010 at 2:12 PM, Rob Biedenharn
wrote:

>
> On May 3, 2010, at 4:56 PM, Anand Ramanathan wrote:
>
> Thanks again, Rob
>
> I made the change you suggested (I realize that the additional action call
> and redirect are redundant), and I still get the images rendering all at
> once in the end. I am a newbie to rails, so dont understand fully how it
> works, but here are my current confusions :
>
> 1. Does all the javascript of a "render :update" block get emitted in one
> go, or does each page.do_this call in that get sent back independently?
>
>
> You get a single response to each request.
>
> If the former, then I understand that this approach wont work for me. If
> there is some way to achieve the latter, then each page.insert_html could be
> sent back independently, and each image could be rendered in parallel. Is
> there any way to achieve the latter, through some setting, perhaps?
>
> 2. Rob said: You're never going to get the images to show up "one at a
>> time" unless you stop doing all the work in one request.
>>
> Does that mean that I cannot call multiple page. do_something calls in
> parallel within the response chain of one request? All I want is to send an
> async request "get_images" and receive a callback "got_one_image" each time
> an image is ready...
>
> Thanks
> Anand
>
>
> Yup! Now, if you really want to "chain" the requests, you could probably do
> some AJAX call so that the JavaScript that is sent back does one image
> replace and then immediately kicks off the next request.  Alternatively, if
> you really only care about the appearance of a sequential load, do the
> sequential "reveals" with JavaScript (via scriptaculous or jQuery-effects).
>
> Of course, it might make a big difference if you're talking about 4-5
> images or 400-500 images, too. Your
> "some_loop_that_gets_one_image_at_a_time" is rather vague after all.
>
> -Rob
>
>
> On Mon, May 3, 2010 at 12:39 PM, Rob Biedenharn <
> r...@agileconsultingllc.com> wrote:
>
>> On May 3, 2010, at 3:20 PM, Anand Ramanathan wrote:
>>
>> Thanks, Rob
>>
>> I tried a variant of your suggestion, where I redirect instead of
>> send_data (since in my case, the images are coming from elsewhere)  - I
>> still have the same issue (that the images are all rendered once in the
>> end,not one by one as they are retrieved). Here is the current code:
>>
>> main controller:
>>
>> def show_images
>>render :update do |page|
>>   page.replace_html 'images-div', ''
>>   @query.load_images! do |image|
>>@image = image
>>page.insert_html :bottom, 'images-div', :partial => 'image' unless
>> @image.id.nil?
>>   end
>> end
>> end
>>
>> query model:
>>
>> def load_images!
>> ...
>>   for(some_loop_that_gets_one_image_at_a_time)
>> block.call(image)
>>   end
>> ...
>> end
>>
>> _image.html.erb
>>
>> <%=image_tag('/images/%s/show' % @image.id)%>
>>
>>
>> Right here, just let the browser leverage HTTP to get the parallelized
>> behavior you seek:
>>
>> <%= image_tag @image.url %>
>>
>> or even:
>>
>> 
>>
>> If you're doing a redirect, the url isn't going to be "hidden" anyway.
>>
>> You're never going to get the images to show up "one at a time" unless you
>> stop doing all the work in one request.
>>
>> -Rob
>>
>>
>>
>> images_controller:
>>
>> def show
>> @image = Image.find(params[:id])
>> redirect_to @image.url
>>   end
>>
>> Thanks
>> Anand
>> On Mon, May 3, 2010 at 11:01 AM, Rob Biedenharn <
>> r...@agileconsultingllc.com> wrote:
>>
>>> On May 3, 2010, at 1:49 PM, candor wrote:
>>>
>>>  I tried a couple other approaches, but no success yet:

 1. I reversed the blocks below - calling the load_images from within
 render :update - that did give me the results, but all at once in the
 end, not as the images show up.
 2. I called redirect_to >>> inner loop in 1, and created a show_image.js.rjs file which calls
 page.insert_html :bottom, 'images-div', :partial => 'image', but I get
 an error 'ActionView::MissingTemplate (Missing template /
 show_image.erb in view path app/views) I dont really understand why
 this is happening - shouldnt it pick the rjs template if present
 instead of the erb?

 What I really want is to leverage http to parallelize the retrieval
 and rendering of images. How do I do that?

 Thanks
 Anand

>>>
>>> 
>>>
>>> Then the browser will ask for that URL and you can respond with a
>>> send_file or send_data (rather than a render or redirect).
>>>
>>> -Rob
>>>
>>>
>>>


 On May 3, 9:11 am, candor  wrote:

> Hi,
>
> I have a rails application where I respond to a request by fetching
> image urls from various web api calls and need to display them as they
> come available. I am able to display all the images 

[Rails] What version of Ruby does/will Rails 3 require?

2010-05-03 Thread Matt Slay
What version of Ruby does or will Rails 3 require?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Having trouble with Validatable

2010-05-03 Thread Bob Smith
I think that's what I did. I know the gem is running because I had
validates_numericality using minimum and maximum, which broke as soon
as I installed the gem. Validatable doesn't have those options. The
include is on line 2 of the model.

Bob

On May 3, 6:53 am, Priyanka Pathak  wrote:
> Hi,
>       You just add include Validatable in your model after installing
> validatable gem. level option will work with active record validation.
> For more information refer this url -http://validatable.rubyforge.org/
>
> --
> Posted viahttp://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

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



[Rails] Integrating hardware with browser

2010-05-03 Thread pepe
Hello,

I've looked high and low and found just 1 post with some information
about this subject, from 2008, and Google searches turned out pretty
much no useful information. I would appreciate any help on this.

I need to be able to control several devices (card reader, printer,
camera, cashier drawer) attached to the client. Has anybody done
anything similar? Any info/links would be greatly appreciated.

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



Re: [Rails] Best HOST and web server

2010-05-03 Thread Vladimir Rybas
I'm using Nginx + Thin
See here:
http://webroar.in/blog/2009/11/25/comparison-of-rails-deployment-stacks-2/
I didn't try WebRoar. But Thin is the best among others.
I believe nobody would argue that Nginx is faster than Apache though.

I've got VDS on RackspaceCloud about a year now. Had no problems with them.
I like them's 24/7 support system through web-based chat. Any problem could
be solved in 10 minutes without any kind of tickets.

On Tue, May 4, 2010 at 5:44 AM, David Zhu  wrote:

> Ok im currently trying to choose between Apache/Nginx, and other stuff
> too (passenger, etc)
>
> Could someone give me a brief description/explanation of which one to
> use? What do you prefer? Pros/Cons?
>
>
>
> Also, whats ur fav VPS company? Do you think that Rackspace Cloud is
> good? Anyone tried it?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



Re: [Rails] how-to display an image living outside the public directory

2010-05-03 Thread Vladimir Rybas
You could have PrivateImagesController with `show` method

and you will get your images through /private_images/image_name.png

in `show` method

(check permissions)
send_file "#{RAILS_ROOT}/private_images_folder/#{params[:image_name]}"


send_file is really slow and will work only when there's not a lot of users
requesting files


In Nginx you could use x-send-file option or something, which makes
send_file work much better. I didn't try that though.

On Tue, May 4, 2010 at 1:08 AM, bill walton  wrote:

> I'm trying to display an image (chart) that lives outside the public
> directory in RAILS_ROOT/private.
>
> The chart contains confidential information and so can't live in /public
> or any sub-directories of /public.
>
> The chart needs to be displayed from a partial.  The first display of
> the page containing the partial is an html render.  Subsequently, the
> user can select a different chart causing an ajax call which replaces
> the content of the image-containing dom element in the partial with a
> new chart image.
>
> Any thoughts / pointers are much appreciated!
>
> Best regards,
> Bill
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



[Rails] Getting class in /lib folder to see a model (const_missing)?

2010-05-03 Thread Mike P.
Hello,

I wrote a new class that I decided to put in the /app/lib folder. Part
way through one of the methods, I call #new on the model, update some of
the fields and then call #save (on the model).

When I do this though, I get a 'const_missing' error coming from Active
Support. Here's the error:

".../lib/active_support/dependencies.rb:105:in `const_missing':
uninitialized constant ClassA::ModelA (NameError)"

The 'ModelA' is the model I'm trying to access, and 'ClassA' is the
class in /app/lib/class_a.rb. I'm not sure why it seems to think that
ModelA is a part of ClassA, perhaps that's the problem?

I would have probably just used "require ../models/model_a.rb", but I
found the following at StackOverflow:

"One way to solve this would be to explicitly require the model file
aircraft.rb. However, you will find this approach quickly leads to
insanity as it will break the Rails auto-loader in subtle and
astonishing ways. Rails is much easier if you work with the Rails class
loader, not against it."

Source:
http://stackoverflow.com/questions/326277/rails-calling-a-model-class-in-a-library

I then found an example at
http://www.strictlyuntyped.com/2008/06/rails-where-to-put-other-files.html
that suggests adding this to the file in the /app/lib folder:

  def self.included(base)
 base.extend(ClassMethods)
  end

And then creating a file in /config/initializers with the following:

  require 'rails_extensions/user_logger'

  ActionController::Base.class_eval do
include ActionController::UserLogger
  end

Being new to Ruby/Rails, I'm really not sure what this supposed to do,
but I'm guessing it will work. That post was written in 2008 though, so
I'm thinking there may be a better way for this.

Does anyone have a suggestion as to the best way to get a class in the
/app/lib folder to see a model?

Thank you very much,
Mike
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] OneLogin releases SAML for Ruby

2010-05-03 Thread Thomas Pedersen
We have just published a neat little toolkit for those of you who are
interested in SAML-enabling your enterprise application. SAML is a
standards-based single sign-on protocol, which allows an identity
provider to securely log users into an application without a password.
Some of the advantages of SAML that you avoid passwords altogether and
can centralize access control at your identity provider.

OneLogin's SAML kit supports both service provider and identity
provider initiated web SSO and comes with a working example
application. If you sign up for a free trial with OneLogin, you can
also test the example app or your own code with a live identity
provider.

http://support.onelogin.com/entries/165434-saml-toolkit-for-ruby-on-rails

Feel free to contact us if you have any questions or are interested in
partnering with OneLogin.

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



[Rails] select tag with unique values from db

2010-05-03 Thread Kris Mojica
Hi. I just want to ask some help regarding my simple project. i'm a
rails newbie and right now, quite stuck with this.

I have this select_tag in my rhtml..

<%= select_tag 'search[outcome]', options_for_select(["", "qp1", "qp2",
"Not Processed"], (params[:search] && params[:search][:outcome])) %>

it works fine. But now, I want to get the distinct values of my
options_for_select  from my database table, green.

how can i do this in my controller and view? thanks.
-- 
Posted via http://www.ruby-forum.com/.

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



Re: [Rails] Best HOST and web server

2010-05-03 Thread Philip Hallstrom

Ok im currently trying to choose between Apache/Nginx, and other stuff
too (passenger, etc) Could someone give me a brief description/ 
explanation of which one to

use? What do you prefer? Pros/Cons?


I use apache/passenger.  I've stuck with Apache because I've got some  
PHP stuff and don't want to mess with fcgi right now.  Passenger is  
nice.



Also, whats ur fav VPS company? Do you think that Rackspace Cloud is
good? Anyone tried it?


I've been a SliceHost.com customer for a number of years.  Good stuff.

-p

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



[Rails] Helper module not included on subsequent requests form engine gem in development from passenger

2010-05-03 Thread Walter McGinnis
Hi,

I'm working on a Rails 2.3.5 based gem that acts as an "add-on" for an
existing application.  It basically pulls in functionality from
another more generic gem and sets up the application to use it.

In its rails/init.rb it adds some helpers to ApplicationHelper.
Here's the init.rb file:

http://github.com/kete/kete_translatable_content/blob/master/rails/init.rb

and here is the other gem's lib that is being included:

http://github.com/kete/mongo_translatable/blob/master/lib/translatables_helper.rb

My issue is that after the initial request to my app on a view that
calls one of those helpers, I get a method not defined error if I'm in
development mode (production works as expected).

I've tried a few different things (unloadable and wrapping method
definitions in unless modules.include? TranslatablesHelpers
conditional), but am not making any headway.

Suggestions?

Cheers,
Walter

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



[Rails] Re: Link_to delete action

2010-05-03 Thread Punit Rathore
The reason it is failing is because it is performing a GET request.

Wrap the "delete relationship" in a form( with :method => :delete) and 
it should work

--
Punit

Greg Ma wrote:
> Hi,
> I am trying to generate a link to delete a relationship, so I've done
> the code bellow. THis is the full code, the part for deleting the
> relationship is at the bottom of the code. I am using a restful
> controller
> 
> <% unless item.user_participe?(current_user) %>
>   <%form_for Participant.new do |f| %>
> <%= f.hidden_field :defi_id, :value => item.id%>
>  <%= f.submit "Participer!", :disabled => !current_user %> <%=
> link_to("Créez un compte pour participer", register_path) unless
> current_user %>
>   <% end %>
> 
> <%else%>
>   Vous participez à ce défi
>   <%= link_to "Ne plus participer",
> participant_path(item.participants.find_by_user_id(current_user.id)) ,
> :method => :delete, :confirm => "Etes vous sur de ne plus vouloir
> participer?" %>
> <%end%>
> 
> This is the error message:
> participant_url failed to generate from {:action=>"show",
> :controller=>"participants", :id=># is_valide: "false", fin_defi: "2010-04-24 00:00:00", created_at:
> "2010-04-25 15:15:35", updated_at: "2010-04-25 15:15:35">}, expected:
> {:action=>"show", :controller=>"participants"}, diff:
> {:id=># fin_defi: "2010-04-24 00:00:00", created_at: "2010-04-25 15:15:35",
> updated_at: "2010-04-25 15:15:35">}
> 
> 
> Greg

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

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



[Rails] Re: render_to_string problem

2010-05-03 Thread Punit Rathore
Are you escaping the javascript returned?(by calling the 
escape_javascript helper?)


Abhishek shukla wrote:
> i have a scenario where a jquery is receiving a response in the string 
> and
> which content html component like "test" ideally 
> in a
> view it should display only "test" but it displaying entire string  id="test">test is there any way i am deal with the problem through 
> js
> or rails?
> 
> Thanks
> abhis

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

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



[Rails] Best HOST and web server

2010-05-03 Thread David Zhu
Ok im currently trying to choose between Apache/Nginx, and other stuff
too (passenger, etc)

Could someone give me a brief description/explanation of which one to
use? What do you prefer? Pros/Cons?



Also, whats ur fav VPS company? Do you think that Rackspace Cloud is
good? Anyone tried it?

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



[Rails] mongrel issue dev vs. prod

2010-05-03 Thread Me
I can start this app in dev mode fine but it blows up when I do -e
production.  Here is what I get from the brief output in the cli:   No
idea what is going on and why it would do that in prod mode.

F:/BACKUP/Backup/ruby/lib/ruby/1.8/erb.rb:441:in `scan': undefined
method `empty?' for nil:NilClass (NoMethodError)
from F:/BACKUP/Backup/ruby/lib/ruby/1.8/erb.rb:497:in
`compile'
from F:/BACKUP/Backup/ruby/lib/ruby/1.8/erb.rb:664:in
`initialize'
from F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.2.2/lib/action_view/template_handlers/erb.rb:51:in `new'
from F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.2.2/lib/action_view/template_handlers/erb.rb:51:in
`compile'
from F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.2.2/lib/action_view/template_handler.rb:11:in `call'
from F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.2.2/lib/action_view/renderable.rb:21:in
`_unmemoized_compiled_source'
from F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/
activesupport-2.2.2/lib/active_support/memoizable.rb:57:in
`compiled_source'
from F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/
activesupport-2.2.2/lib/active_support/memoizable.rb:25:in `__send__'
 ... 29 levels...
from F:/BACKUP/Backup/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/
lib/commands/server.rb:49
from F:/BACKUP/Backup/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:31:in `gem_original_require'
from F:/BACKUP/Backup/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:31:in `require'
from script/server:3

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



Re: [Rails] Re: rendering images dynamically

2010-05-03 Thread Rob Biedenharn


On May 3, 2010, at 4:56 PM, Anand Ramanathan wrote:


Thanks again, Rob

I made the change you suggested (I realize that the additional  
action call and redirect are redundant), and I still get the images  
rendering all at once in the end. I am a newbie to rails, so dont  
understand fully how it works, but here are my current confusions :


1. Does all the javascript of a "render :update" block get emitted  
in one go, or does each page.do_this call in that get sent back  
independently?


You get a single response to each request.

If the former, then I understand that this approach wont work for  
me. If there is some way to achieve the latter, then each  
page.insert_html could be sent back independently, and each image  
could be rendered in parallel. Is there any way to achieve the  
latter, through some setting, perhaps?


2. Rob said: You're never going to get the images to show up "one at  
a time" unless you stop doing all the work in one request.
Does that mean that I cannot call multiple page. do_something calls  
in parallel within the response chain of one request? All I want is  
to send an async request "get_images" and receive a callback  
"got_one_image" each time an image is ready...


Thanks
Anand


Yup! Now, if you really want to "chain" the requests, you could  
probably do some AJAX call so that the JavaScript that is sent back  
does one image replace and then immediately kicks off the next  
request.  Alternatively, if you really only care about the appearance  
of a sequential load, do the sequential "reveals" with JavaScript (via  
scriptaculous or jQuery-effects).


Of course, it might make a big difference if you're talking about 4-5  
images or 400-500 images, too. Your  
"some_loop_that_gets_one_image_at_a_time" is rather vague after all.


-Rob



On Mon, May 3, 2010 at 12:39 PM, Rob Biedenharn > wrote:

On May 3, 2010, at 3:20 PM, Anand Ramanathan wrote:


Thanks, Rob

I tried a variant of your suggestion, where I redirect instead of  
send_data (since in my case, the images are coming from elsewhere)   
- I still have the same issue (that the images are all rendered  
once in the end,not one by one as they are retrieved). Here is the  
current code:


main controller:

def show_images
   render :update do |page|
  page.replace_html 'images-div', ''
  @query.load_images! do |image|
   @image = image
   page.insert_html :bottom, 'images-div', :partial => 'image'  
unless @image.id.nil?

  end
end
end

query model:

def load_images!
...
  for(some_loop_that_gets_one_image_at_a_time)
block.call(image)
  end
...
end

_image.html.erb

<%=image_tag('/images/%s/show' % @image.id)%>


Right here, just let the browser leverage HTTP to get the  
parallelized behavior you seek:


<%= image_tag @image.url %>

or even:



If you're doing a redirect, the url isn't going to be "hidden" anyway.

You're never going to get the images to show up "one at a time"  
unless you stop doing all the work in one request.


-Rob




images_controller:

def show
@image = Image.find(params[:id])
redirect_to @image.url
  end

Thanks
Anand
On Mon, May 3, 2010 at 11:01 AM, Rob Biedenharn > wrote:

On May 3, 2010, at 1:49 PM, candor wrote:

I tried a couple other approaches, but no success yet:

1. I reversed the blocks below - calling the load_images from within
render :update - that did give me the results, but all at once in the
end, not as the images show up.
2. I called redirect_to page.insert_html :bottom, 'images-div', :partial => 'image', but I  
get
an error 'ActionView::MissingTemplate (Missing template  
/

show_image.erb in view path app/views) I dont really understand why
this is happening - shouldnt it pick the rjs template if present
instead of the erb?

What I really want is to leverage http to parallelize the retrieval
and rendering of images. How do I do that?

Thanks
Anand



Then the browser will ask for that URL and you can respond with a  
send_file or send_data (rather than a render or redirect).


-Rob





On May 3, 9:11 am, candor  wrote:
Hi,

I have a rails application where I respond to a request by fetching
image urls from various web api calls and need to display them as  
they

come available. I am able to display all the images once I get them
all, but that causes an unacceptable delay for my user.

One approach I am trying is, from my controller, set an @image
variable, and then pass in a block to the model that retrieves the
image urls. In the block, I call
In the controller, I have:
 @query.load_images! do |image|
 @image = image
 render :update do |page|
   page.insert_html :bottom, 'images-div', :partial => 'images'
 end
   end

In my query model, I have:

def load_images! &block
  for(some_loop_that_gets_one_image_at_a_time) do
  image = get_next_image
  block.call(image)
  end
end

In the _images.html.erb, I have:

<%=image_tag @image.url %>

The problem is that with this approach, I get a DoubleRender

[Rails] How to read config on rails?

2010-05-03 Thread Wason Wang
How to set and read config settings on rails?
For example: a path to be get by a variable.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] install ing rails

2010-05-03 Thread Daniel Perrett
Hi all,
  I'm having trouble installing rails onto my machine .
i have a Solaris 10 x86 box, ruby version 1.8.6 gem version 1.2.0.
when I try to install rails using gems with the command line:
gem install rails

It throws this:
root# gem install rails
ERROR:  While executing gem ... (Errno::ENOENT)
No such file or directory - /usr/local=


has any one got any ideas why its throwing this error?



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

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



Re: [Rails] Re: how-to display an image living outside the public direct

2010-05-03 Thread bwalton.im
Hi Rob,

On Mon, May 3, 2010 at 2:11 PM, Robert Walker  wrote:

> bill walton wrote:
> > I'm trying to display an image (chart) that lives outside the public
> > directory in RAILS_ROOT/private.
>
> You probably looking for send_file:
>

Yeah.  I was trying to use send_data and it wasn't working.  Not sure why,
but send_file does.  I got it working but gmail doesn't send my own posts to
me so couldn't reply that I'd solved it.  Thanks much for replying.  I
appreciate it.

Best regards,
Bill

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



Re: [Rails] Re: rendering images dynamically

2010-05-03 Thread Anand Ramanathan
Thanks again, Rob

I made the change you suggested (I realize that the additional action call
and redirect are redundant), and I still get the images rendering all at
once in the end. I am a newbie to rails, so dont understand fully how it
works, but here are my current confusions :

1. Does all the javascript of a "render :update" block get emitted in one
go, or does each page.do_this call in that get sent back independently? If
the former, then I understand that this approach wont work for me. If there
is some way to achieve the latter, then each page.insert_html could be sent
back independently, and each image could be rendered in parallel. Is there
any way to achieve the latter, through some setting, perhaps?

2. Rob said: You're never going to get the images to show up "one at a time"
> unless you stop doing all the work in one request.
>
Does that mean that I cannot call multiple page. do_something calls in
parallel within the response chain of one request? All I want is to send an
async request "get_images" and receive a callback "got_one_image" each time
an image is ready...


Thanks
Anand

On Mon, May 3, 2010 at 12:39 PM, Rob Biedenharn
wrote:

> On May 3, 2010, at 3:20 PM, Anand Ramanathan wrote:
>
> Thanks, Rob
>
> I tried a variant of your suggestion, where I redirect instead of send_data
> (since in my case, the images are coming from elsewhere)  - I still have the
> same issue (that the images are all rendered once in the end,not one by one
> as they are retrieved). Here is the current code:
>
> main controller:
>
> def show_images
>render :update do |page|
>   page.replace_html 'images-div', ''
>   @query.load_images! do |image|
>@image = image
>page.insert_html :bottom, 'images-div', :partial => 'image' unless
> @image.id.nil?
>   end
> end
> end
>
> query model:
>
> def load_images!
> ...
>   for(some_loop_that_gets_one_image_at_a_time)
> block.call(image)
>   end
> ...
> end
>
> _image.html.erb
>
> <%=image_tag('/images/%s/show' % @image.id)%>
>
>
> Right here, just let the browser leverage HTTP to get the parallelized
> behavior you seek:
>
> <%= image_tag @image.url %>
>
> or even:
>
> 
>
> If you're doing a redirect, the url isn't going to be "hidden" anyway.
>
> You're never going to get the images to show up "one at a time" unless you
> stop doing all the work in one request.
>
> -Rob
>
>
>
> images_controller:
>
> def show
> @image = Image.find(params[:id])
> redirect_to @image.url
>   end
>
> Thanks
> Anand
> On Mon, May 3, 2010 at 11:01 AM, Rob Biedenharn <
> r...@agileconsultingllc.com> wrote:
>
>> On May 3, 2010, at 1:49 PM, candor wrote:
>>
>>  I tried a couple other approaches, but no success yet:
>>>
>>> 1. I reversed the blocks below - calling the load_images from within
>>> render :update - that did give me the results, but all at once in the
>>> end, not as the images show up.
>>> 2. I called redirect_to >> inner loop in 1, and created a show_image.js.rjs file which calls
>>> page.insert_html :bottom, 'images-div', :partial => 'image', but I get
>>> an error 'ActionView::MissingTemplate (Missing template /
>>> show_image.erb in view path app/views) I dont really understand why
>>> this is happening - shouldnt it pick the rjs template if present
>>> instead of the erb?
>>>
>>> What I really want is to leverage http to parallelize the retrieval
>>> and rendering of images. How do I do that?
>>>
>>> Thanks
>>> Anand
>>>
>>
>> 
>>
>> Then the browser will ask for that URL and you can respond with a
>> send_file or send_data (rather than a render or redirect).
>>
>> -Rob
>>
>>
>>
>>>
>>>
>>> On May 3, 9:11 am, candor  wrote:
>>>
 Hi,

 I have a rails application where I respond to a request by fetching
 image urls from various web api calls and need to display them as they
 come available. I am able to display all the images once I get them
 all, but that causes an unacceptable delay for my user.

 One approach I am trying is, from my controller, set an @image
 variable, and then pass in a block to the model that retrieves the
 image urls. In the block, I call
 In the controller, I have:
  @query.load_images! do |image|
  @image = image
  render :update do |page|
page.insert_html :bottom, 'images-div', :partial => 'images'
  end
end

 In my query model, I have:

 def load_images! &block
   for(some_loop_that_gets_one_image_at_a_time) do
   image = get_next_image
   block.call(image)
   end
 end

 In the _images.html.erb, I have:

 <%=image_tag @image.url %>

 The problem is that with this approach, I get a DoubleRenderError, and
 I think this is because render is being called multiple times in the
 block call within the loop.

 What is the best way to get the effect I need (to load images one at a
 time as they become available)?

 Thanks
>>>

[Rails] Re: struggling with accepts_nested_attributes_for

2010-05-03 Thread kc00l
You're right, "Response" is a perfect valid name for a column name, I
just never used a capitalized string for a column name :)

Anyway, I just reproduced your app according to the (little) details
you've given. It just works fine.

This my input tag for a blank response_item for a new Item :



and when editing an existing Item record:



Mmh, are you passing "form.fields_for :response_items" in your
form_for block ?

Could you post the lines of the form_for block in your new/edit
templates for Item model?

How are you building the response_items for the Item instance in the
controller?

In my test app, the new action for ItemsController is :

def new
  @item.new
  12.times do
@item.build
  end
end

If the max number of response_items for a given item is 12 you could
do this in your edit action:

def edit
  @item = Item.find(params[:id])
  difference = 12 - @item.response_items.count
  difference.times do
@item.build
  end
end

But I'm going too far, I think :)

On 3 mai, 13:27, Kevin Tambascio  wrote:
> Actually, "Response" is the name of the column in the database.
> Unfortunately, the schema I was asked to use was not as RoR as I would
> have preferred.  But you think even if that is the real column name, it
> could be tripping up Rails?
>
> I'll try your suggestion out tonight..
>
> Thanks,
> Kevin
> --
> Posted viahttp://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

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



Re: [Rails] Re: "rake TEST=test/unit/whatever_test.rb" is executed 3 times.

2010-05-03 Thread Peter Hickman
Or you could try

rake test:units TEST=test/unit/whatever_test.rb

if it is a unit test for example

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



[Rails] Integration with two rails applications

2010-05-03 Thread Diego Bernardes
Ive build a academic application where users can open tickets, something
like a help desk.

I want this tickets to be opened in Redmine, when the tickets get
updated on Redmine, update on my software too, when the user update on
my software, update in redmine.

I thinking in how to do this in a smart way, what you guys think?

iframe?
plugin to Redmine?
database integration?
forget Redmine and do your own ticket system?
...?

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

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



Re: [Rails] Re: database.yml: encoding: utf8 does not work

2010-05-03 Thread Jeffrey L. Taylor
Quoting Edmond Chui :
> Joshua Muheim wrote:
> > Hi all
> > 
> > According to the Agile 2nd Ed book I added the line encoding: utf8 to my
> > database.yml connections.
> > 
> > But now when running rake I get plenty of errors:
> > 
> > Character set 'utf-8' is not a compiled character set and is not
> > specified in the '/usr/local/mysql/share/mysql/charsets/Index' file
> > 
> > What's wrong here?
> > I checked this Index file, but it seems to be empty...
> > 
> > Thanks a lot
> > Josh
> 
> You have to make sure your database is created to utf8 as the default 
> character set.

And that the encoding is called utf-8.  In my config/database.yml I have:

  encoding: utf8

Also check the default and/or table(s) character set and collation in MySQL.

Jeffrey

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



[Rails] Nested Form - Not Posting... HELP!?!?!

2010-05-03 Thread KT
I have a nested form for survey responses, but the form data is not
being posted to the table; I get no errors, just null values for the
data from params ('question_id', 'answer_id' and 'note)'.

Please help!!!  And thanks in advance !!


Model:
class CreateResponses < ActiveRecord::Migration
  def self.up
create_table :responses do |t|
  t.integer   :request_id
  t.integer   :question_id
  t.integer   :answer_id
  t.text   :note
  t.timestamps
end
  end

-
Controller:

def survey_response
  @request = Request.find(params[:id])
  @survey = Survey.find(:first, :conditions => id =
@request.survey_id)
  @question = Question.find(:all, :conditions => survey_id =
@survey.id)
  @resultSet = Array.new
  @question.each do |question|
answers = Answer.find(:all, :conditions => ["question_id = ?",
question.id])
questionAnswerPair = [question, answers]
@resultSet << questionAnswerPair
questionAnswerPair=[]
answers=[]
  end
  if request.post?
@response = Response.new(:request_id => @request.id,
   :question_id => (params[:question_id]),
   :answer_id => (params[:answer_id]),
   :survey_id => @survey.id,
   :note => (params[:note])
  )
  end

  end

--
survey_response View:

  
<% @resultSet.each do |questionAnswerPair| %>
  
<%= questionAnswerPair[0].content %>
<%= select("@response", "answer_id",
questionAnswerPair[1].collect {|answer| [answer.content,
answer.id]}, :include_blank => true) %>
  
<% end %>
  
  
Additional Comments:
<%= f.text_area :note, :size => "60x5" %>
  
  <%= f.submit "Submit" %>
  <% end %>

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



[Rails] duplicate inserts with field_for and has_many :through

2010-05-03 Thread oren
I see 2 inserts of KeyValue rows on TranslationValue#create action
(and I should only have one). it inserts identical values.

Here are my models, the edit template, the create action and the log:

models:

class TranslationKey < ActiveRecord::Base
  has_many :key_values
  has_many :translation_values, :through => :key_values
end

class TranslationValue < ActiveRecord::Base
  has_many :key_values
  has_many :translation_keys, :through => :key_values
  accepts_nested_attributes_for :translation_keys
end

class KeyValue < ActiveRecord::Base
  belongs_to :translation_value
  belongs_to :translation_key
end

edit tepmlate:

<% form_for(@content) do |f| %>
   <%
if f.error_messages.length > 0
  %>
  
<%= error_messages_for :content, :header_message =>
'Error', :message => '' %>
  
  <%
end
  %>
   
<% f.fields_for :translation_keys do |key_form| %>
  <%= key_form.label :name, 'Key name' %>
  
  <%= key_form.text_field :name %>
  
  
  <%= key_form.label :tag_list, 'Add Tags' %> (separate tags with
a comma ',' )
  
  <%= key_form.text_field :tag_list %>
<% end %>
  
  
<%= f.label :text, 'Content' %>
<%= f.text_area :text %>
  

  
<%= f.submit 'Create' %>
  
<% end %>

create action:

def create
@content = TranslationValue.new

respond_to do |format|
  if @content.update_attributes( params[:translation_value] )
flash[:notice] = 'Key was successfully created.'
format.html { redirect_to(translation_keys_path) }
format.xml  { render :xml => @content, :status
=> :created, :location => @content }
  else
format.html { render :action => "new" }
format.xml  { render :xml => @content.errors, :status
=> :unprocessable_entity }
  end
end
end

Processing TranslationValuesController#create (for 127.0.0.1 at
2010-05-03 19:47:03) [POST]
  Parameters: {"commit"=>"Create",
"translation_value"=>{"text"=>"value13",
"translation_keys_attributes"=>{"0"=>{"name"=>"key13",
"tag_list"=>""}}}, "authenticity_token"=>"J+dt/
qHwHkbKygh0wBPnXPLtpkb3Pb8URxGucEbpLa0="}

  Language Load (0.1ms)   SELECT * FROM `languages`
  TranslationValue Columns (0.6ms)   SHOW FIELDS FROM
`translation_values`
  TranslationKey Columns (0.5ms)   SHOW FIELDS FROM `translation_keys`
  SQL (0.0ms)   BEGIN
  TranslationKey Load (0.2ms)   SELECT `translation_keys`.id FROM
`translation_keys` WHERE (`translation_keys`.`name` = BINARY 'key13')
LIMIT 1
  CACHE (0.0ms)   SELECT `translation_keys`.id FROM `translation_keys`
WHERE (`translation_keys`.`name` = BINARY 'key13') LIMIT 1
  TranslationValue Create (0.1ms)   INSERT INTO `translation_values`
(`created_at`, `updated_at`, `text`, `language_id`) VALUES('2010-05-03
19:47:03', '2010-05-03 19:47:03', 'value13', NULL)
  TranslationKey Create (0.1ms)   INSERT INTO `translation_keys`
(`name`, `created_at`, `updated_at`) VALUES('key13', '2010-05-03
19:47:03', '2010-05-03 19:47:03')
  Tag Load (0.2ms)   SELECT `tags`.* FROM `tags` INNER JOIN `taggings`
ON `tags`.id = `taggings`.tag_id WHERE (((taggings.context = 'tags'
AND taggings.tagger_id IS NULL) AND ((`taggings`.taggable_id = 8) AND
(`taggings`.taggable_type = 'TranslationKey'))) AND
((`taggings`.taggable_id = 8) AND (`taggings`.taggable_type =
'TranslationKey')))
  Tagging Load (0.2ms)   SELECT * FROM `taggings` WHERE
(((`taggings`.`tagger_id` IS NULL AND `taggings`.`tag_id` IN (NULL)
AND `taggings`.`context` = 'tags' AND `taggings`.`tagger_type` IS
NULL) AND (`taggings`.taggable_id = 8 AND `taggings`.taggable_type =
'TranslationKey')) AND (`taggings`.taggable_id = 8 AND
`taggings`.taggable_type = 'TranslationKey'))
  KeyValue Columns (0.5ms)   SHOW FIELDS FROM `key_values`
  KeyValue Create (0.1ms)   INSERT INTO `key_values`
(`translation_key_id`, `translation_value_id`, `created_at`,
`updated_at`) VALUES(8, 21, '2010-05-03 19:47:03', '2010-05-03
19:47:03')
  KeyValue Create (0.1ms)   INSERT INTO `key_values`
(`translation_key_id`, `translation_value_id`, `created_at`,
`updated_at`) VALUES(8, 21, '2010-05-03 19:47:03', '2010-05-03
19:47:03')
  SQL (2.3ms)   COMMIT
Redirected to http://0.0.0.0:3000/translation_keys
Completed in 29ms (DB: 5) | 302 Found [http://0.0.0.0/
translation_values]


Thanks!

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



Re: [Rails] Re: rendering images dynamically

2010-05-03 Thread Rob Biedenharn

On May 3, 2010, at 3:20 PM, Anand Ramanathan wrote:


Thanks, Rob

I tried a variant of your suggestion, where I redirect instead of  
send_data (since in my case, the images are coming from elsewhere)   
- I still have the same issue (that the images are all rendered once  
in the end,not one by one as they are retrieved). Here is the  
current code:


main controller:

def show_images
   render :update do |page|
  page.replace_html 'images-div', ''
  @query.load_images! do |image|
   @image = image
   page.insert_html :bottom, 'images-div', :partial => 'image'  
unless @image.id.nil?

  end
end
end

query model:

def load_images!
...
  for(some_loop_that_gets_one_image_at_a_time)
block.call(image)
  end
...
end

_image.html.erb

<%=image_tag('/images/%s/show' % @image.id)%>


Right here, just let the browser leverage HTTP to get the parallelized  
behavior you seek:


<%= image_tag @image.url %>

or even:



If you're doing a redirect, the url isn't going to be "hidden" anyway.

You're never going to get the images to show up "one at a time" unless  
you stop doing all the work in one request.


-Rob




images_controller:

def show
@image = Image.find(params[:id])
redirect_to @image.url
  end

Thanks
Anand
On Mon, May 3, 2010 at 11:01 AM, Rob Biedenharn > wrote:

On May 3, 2010, at 1:49 PM, candor wrote:

I tried a couple other approaches, but no success yet:

1. I reversed the blocks below - calling the load_images from within
render :update - that did give me the results, but all at once in the
end, not as the images show up.
2. I called redirect_to  'image', but I get
an error 'ActionView::MissingTemplate (Missing template  
/

show_image.erb in view path app/views) I dont really understand why
this is happening - shouldnt it pick the rjs template if present
instead of the erb?

What I really want is to leverage http to parallelize the retrieval
and rendering of images. How do I do that?

Thanks
Anand



Then the browser will ask for that URL and you can respond with a  
send_file or send_data (rather than a render or redirect).


-Rob





On May 3, 9:11 am, candor  wrote:
Hi,

I have a rails application where I respond to a request by fetching
image urls from various web api calls and need to display them as they
come available. I am able to display all the images once I get them
all, but that causes an unacceptable delay for my user.

One approach I am trying is, from my controller, set an @image
variable, and then pass in a block to the model that retrieves the
image urls. In the block, I call
In the controller, I have:
 @query.load_images! do |image|
 @image = image
 render :update do |page|
   page.insert_html :bottom, 'images-div', :partial => 'images'
 end
   end

In my query model, I have:

def load_images! &block
  for(some_loop_that_gets_one_image_at_a_time) do
  image = get_next_image
  block.call(image)
  end
end

In the _images.html.erb, I have:

<%=image_tag @image.url %>

The problem is that with this approach, I get a DoubleRenderError, and
I think this is because render is being called multiple times in the
block call within the loop.

What is the best way to get the effect I need (to load images one at a
time as they become available)?

Thanks
Anand


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



Re: [Rails] Re: rendering images dynamically

2010-05-03 Thread Anand Ramanathan
Thanks, Rob

I tried a variant of your suggestion, where I redirect instead of send_data
(since in my case, the images are coming from elsewhere)  - I still have the
same issue (that the images are all rendered once in the end,not one by one
as they are retrieved). Here is the current code:

main controller:

def show_images
   render :update do |page|
  page.replace_html 'images-div', ''
  @query.load_images! do |image|
   @image = image
   page.insert_html :bottom, 'images-div', :partial => 'image' unless
@image.id.nil?
  end
end
end

query model:

def load_images!
...
  for(some_loop_that_gets_one_image_at_a_time)
block.call(image)
  end
...
end

_image.html.erb

<%=image_tag('/images/%s/show' % @image.id)%>

images_controller:

def show
@image = Image.find(params[:id])
redirect_to @image.url
  end

Thanks
Anand
On Mon, May 3, 2010 at 11:01 AM, Rob Biedenharn
wrote:

> On May 3, 2010, at 1:49 PM, candor wrote:
>
>  I tried a couple other approaches, but no success yet:
>>
>> 1. I reversed the blocks below - calling the load_images from within
>> render :update - that did give me the results, but all at once in the
>> end, not as the images show up.
>> 2. I called redirect_to > inner loop in 1, and created a show_image.js.rjs file which calls
>> page.insert_html :bottom, 'images-div', :partial => 'image', but I get
>> an error 'ActionView::MissingTemplate (Missing template /
>> show_image.erb in view path app/views) I dont really understand why
>> this is happening - shouldnt it pick the rjs template if present
>> instead of the erb?
>>
>> What I really want is to leverage http to parallelize the retrieval
>> and rendering of images. How do I do that?
>>
>> Thanks
>> Anand
>>
>
> 
>
> Then the browser will ask for that URL and you can respond with a send_file
> or send_data (rather than a render or redirect).
>
> -Rob
>
>
>
>>
>>
>> On May 3, 9:11 am, candor  wrote:
>>
>>> Hi,
>>>
>>> I have a rails application where I respond to a request by fetching
>>> image urls from various web api calls and need to display them as they
>>> come available. I am able to display all the images once I get them
>>> all, but that causes an unacceptable delay for my user.
>>>
>>> One approach I am trying is, from my controller, set an @image
>>> variable, and then pass in a block to the model that retrieves the
>>> image urls. In the block, I call
>>> In the controller, I have:
>>>  @query.load_images! do |image|
>>>  @image = image
>>>  render :update do |page|
>>>page.insert_html :bottom, 'images-div', :partial => 'images'
>>>  end
>>>end
>>>
>>> In my query model, I have:
>>>
>>> def load_images! &block
>>>   for(some_loop_that_gets_one_image_at_a_time) do
>>>   image = get_next_image
>>>   block.call(image)
>>>   end
>>> end
>>>
>>> In the _images.html.erb, I have:
>>>
>>> <%=image_tag @image.url %>
>>>
>>> The problem is that with this approach, I get a DoubleRenderError, and
>>> I think this is because render is being called multiple times in the
>>> block call within the loop.
>>>
>>> What is the best way to get the effect I need (to load images one at a
>>> time as they become available)?
>>>
>>> Thanks
>>> Anand
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Ruby on Rails: Talk" group.
>>> To post to this group, send email to rubyonrails-t...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> rubyonrails-talk+unsubscr...@googlegroups.com
>>> .
>>> For more options, visit this group athttp://
>>> groups.google.com/group/rubyonrails-talk?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to rubyonrails-t...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> rubyonrails-talk+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>>
> 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-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



[Rails] Re: how-to display an image living outside the public direct

2010-05-03 Thread Robert Walker
bill walton wrote:
> I'm trying to display an image (chart) that lives outside the public
> directory in RAILS_ROOT/private.

You probably looking for send_file:

http://railsapi.com/doc/rails-v2.3.5/classes/ActionController/Streaming.html#M001587
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] how-to display an image living outside the public directory

2010-05-03 Thread bill walton
I'm trying to display an image (chart) that lives outside the public
directory in RAILS_ROOT/private.  

The chart contains confidential information and so can't live in /public
or any sub-directories of /public.

The chart needs to be displayed from a partial.  The first display of
the page containing the partial is an html render.  Subsequently, the
user can select a different chart causing an ajax call which replaces
the content of the image-containing dom element in the partial with a
new chart image.

Any thoughts / pointers are much appreciated!

Best regards,
Bill

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



Re: [Rails] Re: rendering images dynamically

2010-05-03 Thread Rob Biedenharn

On May 3, 2010, at 1:49 PM, candor wrote:


I tried a couple other approaches, but no success yet:

1. I reversed the blocks below - calling the load_images from within
render :update - that did give me the results, but all at once in the
end, not as the images show up.
2. I called redirect_to  'image', but I get
an error 'ActionView::MissingTemplate (Missing template  
/

show_image.erb in view path app/views) I dont really understand why
this is happening - shouldnt it pick the rjs template if present
instead of the erb?

What I really want is to leverage http to parallelize the retrieval
and rendering of images. How do I do that?

Thanks
Anand




Then the browser will ask for that URL and you can respond with a  
send_file or send_data (rather than a render or redirect).


-Rob





On May 3, 9:11 am, candor  wrote:

Hi,

I have a rails application where I respond to a request by fetching
image urls from various web api calls and need to display them as  
they

come available. I am able to display all the images once I get them
all, but that causes an unacceptable delay for my user.

One approach I am trying is, from my controller, set an @image
variable, and then pass in a block to the model that retrieves the
image urls. In the block, I call
 In the controller, I have:
  @query.load_images! do |image|
  @image = image
  render :update do |page|
page.insert_html :bottom, 'images-div', :partial => 'images'
  end
end

In my query model, I have:

def load_images! &block
   for(some_loop_that_gets_one_image_at_a_time) do
   image = get_next_image
   block.call(image)
   end
end

In the _images.html.erb, I have:

<%=image_tag @image.url %>

The problem is that with this approach, I get a DoubleRenderError,  
and

I think this is because render is being called multiple times in the
block call within the loop.

What is the best way to get the effect I need (to load images one  
at a

time as they become available)?

Thanks
Anand

--
You received this message because you are subscribed to the Google  
Groups "Ruby 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 athttp://groups.google.com/group/rubyonrails-talk?hl=en 
.


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




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



[Rails] Re: rendering images dynamically

2010-05-03 Thread candor
I tried a couple other approaches, but no success yet:

1. I reversed the blocks below - calling the load_images from within
render :update - that did give me the results, but all at once in the
end, not as the images show up.
2. I called redirect_to  'image', but I get
an error 'ActionView::MissingTemplate (Missing template /
show_image.erb in view path app/views) I dont really understand why
this is happening - shouldnt it pick the rjs template if present
instead of the erb?

What I really want is to leverage http to parallelize the retrieval
and rendering of images. How do I do that?

Thanks
Anand



On May 3, 9:11 am, candor  wrote:
> Hi,
>
> I have a rails application where I respond to a request by fetching
> image urls from various web api calls and need to display them as they
> come available. I am able to display all the images once I get them
> all, but that causes an unacceptable delay for my user.
>
> One approach I am trying is, from my controller, set an @image
> variable, and then pass in a block to the model that retrieves the
> image urls. In the block, I call
>      In the controller, I have:
>   @query.load_images! do |image|
>       @image = image
>       render :update do |page|
>         page.insert_html :bottom, 'images-div', :partial => 'images'
>       end
>     end
>
> In my query model, I have:
>
> def load_images! &block
>    for(some_loop_that_gets_one_image_at_a_time) do
>        image = get_next_image
>        block.call(image)
>    end
> end
>
> In the _images.html.erb, I have:
>
> <%=image_tag @image.url %>
>
> The problem is that with this approach, I get a DoubleRenderError, and
> I think this is because render is being called multiple times in the
> block call within the loop.
>
> What is the best way to get the effect I need (to load images one at a
> time as they become available)?
>
> Thanks
> Anand
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

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



[Rails] Re: mysql adapter & 2 statments

2010-05-03 Thread Laurent Buffat

>> db = ActiveRecord::Base.connection 
>> db.execute("CREATE TABLE  toto (id int); DROP TABLE toto;")

Sorry for this typo.

Laurent

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

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



[Rails] mysql adapter & 2 statments

2010-05-03 Thread Laurent Buffat
Hi,

I have an error with mysql adapter when where is two statment in the
same sql execution.
I don't have this error with postgres adapter.

If I perform, on the console, this "stupide" code :

> db = ctiveRecord::Base.connection 
> db.execute(" db.execute("CREATE TABLE  toto (id int); DROP TABLE toto;")

I have the error :

//

ActiveRecord::StatementInvalid: Mysql::Error: You have an error in your
SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near 'DROP TABLE toto' at line 1:
CREATE TABLE toto (id int); DROP TABLE toto;
  from
/Library/WebServer/Documents/RubyTimeNetV2/vendor/plugins/rows_logger/init.rb:36:in
`log'
  from
/Library/WebServer/Documents/RubyTimeNetV2/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:304:in
`execute_without_query_stats'
  from
/Library/WebServer/Documents/RubyTimeNetV2/vendor/plugins/query_stats/lib/query_stats/recorder.rb:16:in
`execute'
  from
/Library/WebServer/Documents/RubyTimeNetV2/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:8:in
`realtime'
  from
/Library/WebServer/Documents/RubyTimeNetV2/vendor/plugins/query_stats/lib/query_stats/recorder.rb:15:in
`execute'
  from (irb):116



If I separate the two (stupids) statment, no error :

>> db.execute("CREATE TABLE toto (id int);")
=> nil
>> db.execute("DROP table toto;")
=> nil

Thanks

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

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



[Rails] Re: Updating an Application

2010-05-03 Thread Frederick Cheung
On May 3, 5:14 pm, Michael Pavling  wrote:
> I'd suggest a review of your internal processes with all the
> developers, PMs and other stakeholders to discuss how to manage code
> deployment. As a suggestion, I'd recommend a branch of your code for
> each of your deployed client sites. Using Git/Mercurial it's not a
> huge nightmare to manage merging core changes while keeping
> client-specific code in the respective branches (although I'd
> recommend that was a task delegated to one "change manager" who can
> keep on top of it, and be responsible for all changes - and banging
> the heads of anyone who "breaks the build" :-)

or depending on how different the various versions are (and in
addition to what Michael has said) you could make the code support
what all of your customers want and make the choice between the
variants a configuration option. If you absolutely do have to make
code changes to different deployments you could deploy those changes
as plugins which re-open / monkey patch application classes (or
toggles configuration options). You can set rails to load plugins from
a directory other than vendor/plugins. Like that the app deploy would
be the same across all deployments and it would load plugins in (for
example) ~/site_customizations/ that would patch in per deployment
stuff

Fred

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



[Rails] logger with backgrounDrb

2010-05-03 Thread Jonhy Pear
Hello,

I have a backgrounDrb worker calling a ActiveRecord object, ex:

worker:

def process_campaign
   Campaign.process
end

campaign.rb:

Campaign < ActiveRecord::Base
..
..

def self.process
  logger.info("Start processing...")
end


If I test in dev env, the line logger.info("Start processing...") throws the
correct log info to development.log

However, in production the method process is called bu the log line is not
written to production.log
If I call the method process from a Controller, the log is written to
production.log.

Can someone point me something where I should start looking?


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



[Rails] Netbeans error?

2010-05-03 Thread slindsey3000
History... before it went to heck...

I have been working a project in Netbeans for a month.  I did a gem
update outside of Netbeans while I was installing ImageMagick and
RMagick... I also had to remove one verson of ImageMagick to use the
one compatible with RMagick.

Everything was working well... then I went to migrate my DB back to
start fresh again and I got :

Malformed version number string mswin32 (ArgumentError)

(LARGER TRACE)

 :/Ruby/lib/ruby/site_ruby/1.8/rubygems/version.rb:182:in
`initialize': Malformed version number string mswin32 (ArgumentError)
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/
vendor_gem_source_index.rb:105:in `new'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/
vendor_gem_source_index.rb:105:in `version_for_dir'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/
vendor_gem_source_index.rb:47:in `refresh!'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/
vendor_gem_source_index.rb:45:in `each'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/
vendor_gem_source_index.rb:45:in `refresh!'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/
vendor_gem_source_index.rb:29:in `initialize'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/
gem_dependency.rb:21:in `new'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/
gem_dependency.rb:21:in `add_frozen_gem_path'

Now I can't do anything... can't run project... can do anything...

Any thoughts?  Did updating Ruby gems outside Netbeans screw
everything up?  I am happy to start fresh but can't do a darn thing.

I am at the point where I am going to restart the whole project and
copy each file back individually!!! ahhh!!

All other old rails projects work just fine.

Thanks!

Shawn

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



[Rails] rendering images dynamically

2010-05-03 Thread candor
Hi,

I have a rails application where I respond to a request by fetching
image urls from various web api calls and need to display them as they
come available. I am able to display all the images once I get them
all, but that causes an unacceptable delay for my user.

One approach I am trying is, from my controller, set an @image
variable, and then pass in a block to the model that retrieves the
image urls. In the block, I call
 In the controller, I have:
  @query.load_images! do |image|
  @image = image
  render :update do |page|
page.insert_html :bottom, 'images-div', :partial => 'images'
  end
end

In my query model, I have:

def load_images! &block
   for(some_loop_that_gets_one_image_at_a_time) do
   image = get_next_image
   block.call(image)
   end
end

In the _images.html.erb, I have:

<%=image_tag @image.url %>

The problem is that with this approach, I get a DoubleRenderError, and
I think this is because render is being called multiple times in the
block call within the loop.

What is the best way to get the effect I need (to load images one at a
time as they become available)?

Thanks
Anand

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



Re: [Rails] Re: dev tool

2010-05-03 Thread v4 forums
+1 for Vim and rails.vim plugin.

On Mon, May 3, 2010 at 2:40 AM, nirosh  wrote:

> Aptana RadRail,Netbeans i'm using these 2 for my dev. pretty cool for
> me try it.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



Re: [Rails] Re: Updating an Application

2010-05-03 Thread Michael Pavling
On 3 May 2010 17:02, doug  wrote:
>> Why do you need this system rather than just pulling down the latest
>> version from source control ?
>
> Because there are some files that may have been modified with customer-
> specific code.  We never want to overwrite these files.  However, if a
> file in this group doesn't exist on the system being updated (as in
> the case where the update adds the file) we want to write the file.

So you *don't* have a SCR-managed version of your different client
sites differences?

Well... that's not the most unusual situation, but it's not exactly
great practice.

I'd suggest a review of your internal processes with all the
developers, PMs and other stakeholders to discuss how to manage code
deployment. As a suggestion, I'd recommend a branch of your code for
each of your deployed client sites. Using Git/Mercurial it's not a
huge nightmare to manage merging core changes while keeping
client-specific code in the respective branches (although I'd
recommend that was a task delegated to one "change manager" who can
keep on top of it, and be responsible for all changes - and banging
the heads of anyone who "breaks the build" :-)

Approaching the problem this way, you can deal with any updates in
source control long before deployment, ensuring the client is going to
get the right stuff (and with a staging server, that everything is
going to continue working). Approaching it from the angle you're
musing about, you'll be constantly walking a tightrope that you
accidentally apply the wrong tar file to the wrong site - and that's
on the live site too.

HTH

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



[Rails] Re: Need Help on "Virtual Timer Expired" issue

2010-05-03 Thread v4 forums
Just a small update, I got this issue fixed by downgrading the version of
'mysql' gem that I installed from 2.8.1 to 2.7 and the rake db:migrate
stopped throwing the 'Virtual Time Expired' error.

Thanks

On Mon, May 3, 2010 at 8:17 AM, v4 forums  wrote:

> Hi Everyone,
>
> I am new to RoR and in the past couple of years, I was mostly involved in
> Java/J2EE programming.
>
> I've just started learning ruby and rails from the last few days.
> Programming in Ruby on Rails is fun, the one thing I like the most is not
> worrying about the boiler plate code implementations that we quite often end
> up/setting up while developing any web application. But for some reason, I
> found it was not that easy to install RoR on a linux machine like with
> Ubuntu and get it running. I had to spend quite a lot of time to get my
> ruby, rails installed and bring up the webrick server. It doesn't end there,
> I had some older version of e-books for Rails which used to have classic
> pagination and scaffolding stuff which simple doesn't work on the later
> version of rails. It was quite bit late to realize all these changes in
> place for Rails 2.3.5 but then I managed to come out of every problem that I
> faced and was able to build my first rails application. It all went good
> until this error when I tried to create some sessions on the database
> through rake or even for that matter run db:migrate via rake. Even running
> rake with 'trace' on didn't helped me much.
>
>  *Virtual Timer Expired* (on executing rake
> db:sessions:create or db:migrate)
>
> As I did some googling around, the only suggestion I finding is re-install
> or downgrade ruby version. But it is the last thing I would like to do after
> progressing this long.
>
> I will be really glad to hear from you, if there is a better solution to
> fix this problem.
>
> The details of my current environment are follows:
>
> OS : Ubuntu Jaunty Jakalope
> Ruby Version : ruby 1.8.6 (2010-02-05 patchlevel 399) [i686-linux]
> Rails Version: Rails 2.3.5
> Rake Version: rake, version 0.8.7
> Database: mysql  Ver 14.12 Distrib 5.0.75, for debian-linux-gnu (i486)
> using readline 5.2
>
> Thanks
>
>

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



[Rails] How to judge whether SSL has been applied?

2010-05-03 Thread Wason Wang
How to judge whether or not the SSL has been applied on the server IIS
with ruby on rails?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Updating an Application

2010-05-03 Thread doug
> But if you *must* do something like the above, it's called `rsync` and
> it handles case #3 as well.

I'm going to look into this.  Thanks for the suggestion.

... doug

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



[Rails] Re: Updating an Application

2010-05-03 Thread doug
> Why do you need this system rather than just pulling down the latest
> version from source control ?

Because there are some files that may have been modified with customer-
specific code.  We never want to overwrite these files.  However, if a
file in this group doesn't exist on the system being updated (as in
the case where the update adds the file) we want to write the file.

Thanks for the input.

  ... doug

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



[Rails] Displaying Errors with Code 500 as 200 in Rails3

2010-05-03 Thread kb
Hi!

We make Facebook-Apps with Rails3.
Facebook do not display Errormessages with a Errorcode 500. So we have
to display what comes as error with Code 200.
I am looking forward to modify an existing Gem called buddy which
makes the Facebook-Stuff.

But I don't know how to do this in Rails3. I think this has something
to do with Actioncontroller::Rescue
But I dont know, what to change.

Greetings from Germany,
Klaus

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



[Rails] How to set default cookie domain in Rails3

2010-05-03 Thread Jabulani
I want to set default cookie domain for my application to
".mydomain.com" to allow cookie session be preserved across
subdomains.
I use  => config.action_dispatch.session = {:domain =>
".mydomain.com"} in application.rb, but thats not working. The cookie
is saved as 'mydomain.com'

Thanks for the help!

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



[Rails] how to access serialized attributes in my views?

2010-05-03 Thread Lille
Hi,

I have a serialized attribute in a model:

 serialize :some_array, Array

(I've unit tested this attribute and it works just like an Array
should.)

Now, how do I supply my some_array attribute to my views so that I can
reference elements of my array? The following, for example, won't
work:

<%= f.text_field :some_array[0] %>

Thanks,

Lille

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



[Rails] Re: How do you use rails with (triggers and Oracle)?

2010-05-03 Thread Denzel De rocker
Chris Richards wrote:
> I have an existing database in Oracle.  All the tables have triggers
> that insert the next value from the table sequence into the id column.
> 
> I have told rails about the sequence using set_sequence_name.
> 
> The problem occurs when rails trys to insert a new row.  It grabs the
> nextval from the sequence and uses that in its INSERT sql,  BUT then the
> oracle trigger trigger automatically takes over (as it should) and grabs
> the next value from the sequence and forces it into the inserted row.
> This results in rails having the wrong id for that record.  The id that
> rails has is minus one from what it should be.
> 
> My current solution is to minus one from the model's id when i need to
> use it subsequently.  This is not an ideal solution and is a real ball
> ache.
> 
> Is there any way around this problem with ActiveRecord? or is there a
> very clever way round it?
> 
> Any advice would be useful.
> 
> Thanks
> 
> Chris Richards

I have the same problem. I'm using the oracle enhanced adapter v 1.2.4. 
The adapter does look for a present trigger with the default trigger 
name (i.e. _PKT), but I don't use default names so he 
doesn't find it.

My current solution is to simply override the method 
has_primary_key_trigger? that looks for the trigger:

[code]
module ActiveRecord
  module ConnectionAdapters
class OracleEnhancedAdapter < AbstractAdapter
  def has_primary_key_trigger?(table_name, owner = nil, 
desc_table_name = nil, db_link = nil)
true
  end
end
  end
end
[/code]

As I always use triggers, this works for me, but I know it isn't the 
best solution.

Regards,

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

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



[Rails] Re: "rake TEST=test/unit/whatever_test.rb" is executed 3 times.

2010-05-03 Thread Frederick Cheung


On May 3, 1:15 pm, Damaris Fuentes  wrote:
> Hi you all,
>
> Is this a normal behaviour?
> The test is the default one when you create a model and I'm using Ruby
> 1.8.6. and Rails 2.1.2. rake version is 0.8.6

If you want to run just one test I'd do ruby -Itest test/unit/
foo_test.rb

I think the issue is that the default task in a rails project runs 3
sub tasks: test:units, test:functionals and test:integration. Each of
these tasks then pickup the TEST environment variable you've set

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-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

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



[Rails] "rake TEST=test/unit/whatever_test.rb" is executed 3 times.

2010-05-03 Thread Damaris Fuentes
Hi you all,
I execute "rake TEST= test/unit/whatever_test.rb, and it is executed 3
times. That it, the output is something like:

c:/ruby .. "test/unit/whatever_test.rb"
Loaded suite .
Started
F
Finished in 0.8
...
1 tests, 1 assertions, 1 failures, 0 errors

c:/ruby .. "test/unit/whatever_test.rb"
Loaded suite .
Started
F
Finished in 0.8
...
1 tests, 1 assertions, 1 failures, 0 errors

c:/ruby .. "test/unit/whatever_test.rb"
Loaded suite .
Started
F
Finished in 0.8
...
1 tests, 1 assertions, 1 failures, 0 errors

And at the end:
Errors running test:units, test:functionals and test:integration!

Is this a normal behaviour?
The test is the default one when you create a model and I'm using Ruby
1.8.6. and Rails 2.1.2. rake version is 0.8.6
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Ubuntu Linux Editor / Prettiefier

2010-05-03 Thread tonypm


> "Normal"?  What makes them any more or less "normal"?
>

i just knew someone would pick up on that comment!!   I added in
Windows to clarify, but re reading what I wrote, I should have said
cut and paste buffer keystrokes, which is what I think was
predominantly in my mind.  The reason I stuck with the wording normal,
was that it occurred to me these were not just windows keystrokes but
the keystrokes used by  most web browsers, which these days IMHO makes
them pretty much the norm.

But what the heck - I am getting better with emacs all the time,
running the console in one of the buffers is working well, and
switching between buffers to re run commands etc is now becoming much
more automatic.  I just need to learn to resist the temptation to pick
up the mouse!

Tonypm

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



[Rails] Re: struggling with accepts_nested_attributes_for

2010-05-03 Thread Kevin Tambascio
Actually, "Response" is the name of the column in the database. 
Unfortunately, the schema I was asked to use was not as RoR as I would 
have preferred.  But you think even if that is the real column name, it 
could be tripping up Rails?

I'll try your suggestion out tonight..

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

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



[Rails] Re: rails ROUTING map.root

2010-05-03 Thread Priyanka Pathak
Hi,
During processing of request first it executes routes. so, it's not 
possible to add above type of conditional statement (authentication). 
For conditional routing refer - 
http://www.buildingwebapps.com/articles/7082-enhancing-conditional-routing-in-rails
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Having trouble with Validatable

2010-05-03 Thread Priyanka Pathak
Hi,
  You just add include Validatable in your model after installing 
validatable gem. level option will work with active record validation. 
For more information refer this url - http://validatable.rubyforge.org/

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

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



[Rails] local Ruby on rails events in Gurgaon,Delhi India...?

2010-05-03 Thread shyam mohan
Hi All!
Is there any Local Group ... or events on ruby on rails ...Meets etc
I want to join that .
Please tell me abt that...


-Shyam

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



Re: [Rails] Re: Need Some Help in Configuring Webrick Server

2010-05-03 Thread Sajith Vimukthi
Thanks a lot Fredrick. It works.

On Mon, May 3, 2010 at 3:06 PM, Frederick Cheung  wrote:

>
>
> On May 3, 5:35 am, Sajith Vimukthi  wrote:
> > Could not find RubyGem hoe (>= 1.3.0) (Gem::LoadError)
> >
> > Anyway I tried with several options such as without the -e part and etc.
> >
> > What is this missing RubyGem hoe thing?
> >
> > How can I get through this? Thanks in advance.
>
> rubygems is a package management system for ruby libraries, and you're
> being told that a library is missing.
> You can install gems with gem install gem_name
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
Thanks,
Regards,
Sajith Vimukthi Weerakoon,
T .P No : ++94-716102392

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



[Rails] Re: Finding the next item, in a group of items.

2010-05-03 Thread Joe
So I change it to this: <%= render :partial =>
@category.tutorials.ordered_by_position %>
and I get the error: undefined method `ordered_by_position'

I'm guessing that's because I have to create a method that orders them
by position. However I'm a noob in ruby on rails, where do I create
the method, and how do I make it order them by position?

Thanks in advance,

Sorry for being such a noob,

Joe

On May 3, 10:35 am, Frederick Cheung 
wrote:
> On May 3, 8:12 am, Joe  wrote:
>
> > Ok, so I've created my position thing for every tutorial. However now
> > I need to know how I can setup render :partial to order the tutorials
> > using the position, and then if two (or more) tutorials have the same
> > position, then go back and check there id, and order the ones with the
> > same position by id.
>
> > This is how I'm currently displaying the tutorials:
>
> > <%= render :partial => @category.tutorials %>
>
> > Does anyone have any ideas how I can adapt this?
>
> I'd probably create a named_scope on Tutorial which ordered things by
> position. Since named_scopes can be chained with each other and with
> an association you could do @category.tutorials.ordered_by_position
>
> Fred
>
>
>
> > Thanks In Advance,
>
> > Joe
>
> > On May 2, 9:18 pm, Joe  wrote:
>
> > > Ok, So it seems that this whole tutorial ordering thing seems to be
> > > the best way to go (thanks to philip anyway for giving me the code to
> > > do it with ids if I wanted to);
> > > The problem is I'm really a complete noob in RoR. I know how to create
> > > migrations, however creating a "position" variable i which they were
> > > independent to the category the tutorials were in; I have absolutely
> > > no idea how to do that. And you talk about writing methods, I also do
> > > not know where these methods would be created (inside a controller
> > > perhaps?).
>
> > > Any help with this task would be kindly appriciated,
>
> > > Thanks In Advance,
>
> > > Joe
>
> > > On May 2, 7:18 pm, Philip Hallstrom  wrote:
>
> > > > >> The tutorials are then displayed in order of there id (auto-
> > > > >> incrementing) in their categories show method.
> > > > >> The thing is, I want to create a link that goes from one tutorial
> > > > >> (with an id of 10 for example) to the next tutorial in that category
> > > > >> (which might not have an id of 11, as I create different tutorials at
> > > > >> different times, therefore creating different ids for two tutorials
> > > > >> seemingly next to eachother in order).
>
> > > > >> Obviously I know I will need something like this:
> > > > >> <%= link_to 'Next lesson',   %>
>
> > > > >> but I just don't know how I can manage it..
>
> > > > >> By the way, every tutorial has a: category_id  to determain which
> > > > >> category they are in (this is an integer).
>
> > > > > If I were you, i'd create a position column on tutorials, which
> > > > > determines the ordering of tutorials for a category (ordering by id
> > > > > might seem the simplest but stops you from ever reordering tutorials.
> > > > > Given a tutorial, the next one is the first one in the same category
> > > > > whose position is greater than the current ones (you could write a
> > > > > next_tutorial method on tutorial). There's a plugin called
> > > > > acts_as_list that you might find helpful maintaining the position
> > > > > column. If you're hell bent on ordering by id then it's as if id is
> > > > > your position column
>
> > > > > Fred
>
> > > > I agree with Fred as it allows you to easily re-order the tutorials if  
> > > > you want to, but if you don't... then...
>
> > > > next_tutorial = Tutorial.find(:conditions => ["id > ? AND category_id  
> > > > = ?", current_tutorial_id, current_category_id], :order =>  
> > > > 'id', :limit => 1)
>
> > > > prev_tutorial = Tutorial.find(:conditions => ["id < ? AND category_id  
> > > > = ?", current_tutorial_id, current_category_id], :order => 'id  
> > > > DESC', :limit => 1)
>
> > > > --
> > > > You received this message because you are subscribed to the Google 
> > > > Groups "Ruby on Rails: Talk" group.
> > > > To post to this group, send email to rubyonrails-t...@googlegroups.com.
> > > > To unsubscribe from this group, send email to 
> > > > rubyonrails-talk+unsubscr...@googlegroups.com.
> > > > For more options, visit this group 
> > > > athttp://groups.google.com/group/rubyonrails-talk?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "Ruby on Rails: Talk" group.
> > > To post to this group, send email to rubyonrails-t...@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > rubyonrails-talk+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/rubyonrails-talk?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-t...@googlegroups.c

[Rails] Re: Need Some Help in Configuring Webrick Server

2010-05-03 Thread Frederick Cheung


On May 3, 5:35 am, Sajith Vimukthi  wrote:
> Could not find RubyGem hoe (>= 1.3.0) (Gem::LoadError)
>
> Anyway I tried with several options such as without the -e part and etc.
>
> What is this missing RubyGem hoe thing?
>
> How can I get through this? Thanks in advance.

rubygems is a package management system for ruby libraries, and you're
being told that a library is missing.
You can install gems with gem install gem_name

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



[Rails] Re: Finding the next item, in a group of items.

2010-05-03 Thread Frederick Cheung


On May 3, 8:12 am, Joe  wrote:
> Ok, so I've created my position thing for every tutorial. However now
> I need to know how I can setup render :partial to order the tutorials
> using the position, and then if two (or more) tutorials have the same
> position, then go back and check there id, and order the ones with the
> same position by id.
>
> This is how I'm currently displaying the tutorials:
>
> <%= render :partial => @category.tutorials %>
>
> Does anyone have any ideas how I can adapt this?
>

I'd probably create a named_scope on Tutorial which ordered things by
position. Since named_scopes can be chained with each other and with
an association you could do @category.tutorials.ordered_by_position

Fred
> Thanks In Advance,
>
> Joe
>
> On May 2, 9:18 pm, Joe  wrote:
>
>
>
>
>
> > Ok, So it seems that this whole tutorial ordering thing seems to be
> > the best way to go (thanks to philip anyway for giving me the code to
> > do it with ids if I wanted to);
> > The problem is I'm really a complete noob in RoR. I know how to create
> > migrations, however creating a "position" variable i which they were
> > independent to the category the tutorials were in; I have absolutely
> > no idea how to do that. And you talk about writing methods, I also do
> > not know where these methods would be created (inside a controller
> > perhaps?).
>
> > Any help with this task would be kindly appriciated,
>
> > Thanks In Advance,
>
> > Joe
>
> > On May 2, 7:18 pm, Philip Hallstrom  wrote:
>
> > > >> The tutorials are then displayed in order of there id (auto-
> > > >> incrementing) in their categories show method.
> > > >> The thing is, I want to create a link that goes from one tutorial
> > > >> (with an id of 10 for example) to the next tutorial in that category
> > > >> (which might not have an id of 11, as I create different tutorials at
> > > >> different times, therefore creating different ids for two tutorials
> > > >> seemingly next to eachother in order).
>
> > > >> Obviously I know I will need something like this:
> > > >> <%= link_to 'Next lesson',   %>
>
> > > >> but I just don't know how I can manage it..
>
> > > >> By the way, every tutorial has a: category_id  to determain which
> > > >> category they are in (this is an integer).
>
> > > > If I were you, i'd create a position column on tutorials, which
> > > > determines the ordering of tutorials for a category (ordering by id
> > > > might seem the simplest but stops you from ever reordering tutorials.
> > > > Given a tutorial, the next one is the first one in the same category
> > > > whose position is greater than the current ones (you could write a
> > > > next_tutorial method on tutorial). There's a plugin called
> > > > acts_as_list that you might find helpful maintaining the position
> > > > column. If you're hell bent on ordering by id then it's as if id is
> > > > your position column
>
> > > > Fred
>
> > > I agree with Fred as it allows you to easily re-order the tutorials if  
> > > you want to, but if you don't... then...
>
> > > next_tutorial = Tutorial.find(:conditions => ["id > ? AND category_id  
> > > = ?", current_tutorial_id, current_category_id], :order =>  
> > > 'id', :limit => 1)
>
> > > prev_tutorial = Tutorial.find(:conditions => ["id < ? AND category_id  
> > > = ?", current_tutorial_id, current_category_id], :order => 'id  
> > > DESC', :limit => 1)
>
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "Ruby on Rails: Talk" group.
> > > To post to this group, send email to rubyonrails-t...@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > rubyonrails-talk+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/rubyonrails-talk?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-t...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > rubyonrails-talk+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/rubyonrails-talk?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

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



[Rails] Re: struggling with accepts_nested_attributes_for

2010-05-03 Thread kc00l
Hello,
I think the issue could be in the 'Response' attribute in :

accepts_nested_attributes_for :response_items, :allow_destroy =>
true,
:reject_if => proc { |attributes| attributes['Response'].blank? }

The way you wrote this method means that creations (or updates) of
ResponseItem instances are being rejected if the attribute named
'Response' is blank. I don't think ResponseItem has a 'Response'
attribute, which by the way is an invalid name (capitalized) for an
attribute name.

If you correct the statement above with this:

accepts_nested_attributes_for :response_items, :allow_destroy =>
true,
:reject_if => proc { |attributes| attributes.all? {|k,v|
v.blank?} }

ResponseItem instances will be rejected (not saved) when all
attributes are blank.
If you need to reject instances when a specific attribute is blank you
could substitute the 'proc' with :

proc { |attributes| attributes['attribute_name'].blank? }


On May 2, 11:27 pm, Kevin Tambascio  wrote:
> Hi,
>
> I've been struggling with getting accepts_nested_attributes_for to work
> perfectly with a nested model form.  This is a project that was started
> before Rails 2.0, and I'm trying to use new techniques in the new
> functionality.  I'm presently using Rails 2.3.4.  I'm down to one last
> issue, and I'm not finding an answer so far.
>
> The system I'm building deals with Items that have ResponseItem's as
> children (think questions with multiple choices). Creating a new item
> works fine.  By default, the item has 12 potential responses.  A form is
> rendered that allows the user to enter up to 12 responses.  The saving
> of the new item works fine.
>
> The issue is with editing.  Say the item was created with 4 responses.
> When the edit form is rendered, 4 of the responses are shown, and the
> other 8 are blank (only the first 4 are representing objects in the
> databases, the blank ones have no database records).  When the form is
> submitted, I'm receiving an HTTP 500 error, with this output in the log:
>
> Completed in 176ms (View: 95, DB: 22) | 200 OK
> [http://localhost/items/edit/648?assessment_id=1]
> /!\ FAILSAFE /!\  Sun May 02 21:04:01 UTC 2010
>   Status: 500 Internal Server Error
>   expected Array (got Hash) for param `response_items_attributes'
>     /opt/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/utils.rb:85:in
> `normalize_params'
>     /opt/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/utils.rb:94:in
> `normalize_params'
>     /opt/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/utils.rb:62:in
> `parse_nested_query'
>     /opt/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/utils.rb:60:in
> `each'
>     /opt/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/utils.rb:60:in
> `parse_nested_query'
>     
> /opt/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/request.rb:140: in
> `POST'
> 
>
> The call stack does not even show my code, it's all framework so far.
>
> The models look like this:
>
> class Item < ActiveRecord::base
>   ...
>   attr_accessor :response_item_ids
>   has_many :response_items
>   accepts_nested_attributes_for :response_items, :allow_destroy => true,
>     :reject_if => proc { |attributes| attributes['Response'].blank? }
>   ...
> end
>
> class ResponseItem < ActiveRecord::base
>   ...
>   belongs_to :item
>   ...
> end
>
> The only real clue so far, is the names of the fields on the edit form
> are different whether it's a pre-filled response, or a blank one.
>
> This is for a response that has an item in the database:
> 
>      name="item[response_items_attributes][1311][Response]" size="30"
> type="text" value="Very familiar - I could explain common
> product/service offerings" />
>   
>
> This is for a blank response item, with no object in the database:
> 
>      name="item[response_items_attributes][][Response]" size="30" type="text"
> />
>   
>
> My hunch is that mixing a form with some items that have an ID, and some
> that are blank for an ID, is potentially causing trouble in the
> normalize_params function?
>
> One possible solution could be that for blank responses, I create a
> temporary database item, so that they have an ID field filled out.  When
> I try to edit an item with all 12 responses, it does work because
> there's an ID field for each response.
>
> Clear as mud?  :)  Tough to explain this in a forum.  If anyone has any
> thoughts, I'd appreciate it.
>
> Thanks,
> Kevin
> --
> Posted viahttp://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send e

[Rails] Need Some Help in Configuring Webrick Server

2010-05-03 Thread Sajith Vimukthi
Hi,

I am very new to ruby and I have encountered some problem in starting up the
webrick server. I used the command ruby script/server webrick -e production and
I encounter with the following error.
C:\Redmine\redmine-0.9.4>ruby script/server webrick -e production => Booting
WEBrick => Rails 2.3.5 application starting on
http://0.0.0.0:3000C:/Ruby/lib/ruby/site_ruby/1.8/rubygems.rb:636:in
`report_activate_error':
Could not find RubyGem hoe (>= 1.3.0) (Gem::LoadError)

Anyway I tried with several options such as without the -e part and etc.

What is this missing RubyGem hoe thing?

How can I get through this? Thanks in advance.

Thanks,
Regards,
Sajith Vimukthi Weerakoon,
T .P No : ++94-716102392

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



[Rails] Need Help on "Virtual Timer Expired" issue

2010-05-03 Thread v4 forums
Hi Everyone,

I am new to RoR and in the past couple of years, I was mostly involved in
Java/J2EE programming.

I've just started learning ruby and rails from the last few days.
Programming in Ruby on Rails is fun, the one thing I like the most is not
worrying about the boiler plate code implementations that we quite often end
up/setting up while developing any web application. But for some reason, I
found it was not that easy to install RoR on a linux machine like with
Ubuntu and get it running. I had to spend quite a lot of time to get my
ruby, rails installed and bring up the webrick server. It doesn't end there,
I had some older version of e-books for Rails which used to have classic
pagination and scaffolding stuff which simple doesn't work on the later
version of rails. It was quite bit late to realize all these changes in
place for Rails 2.3.5 but then I managed to come out of every problem that I
faced and was able to build my first rails application. It all went good
until this error when I tried to create some sessions on the database
through rake or even for that matter run db:migrate via rake. Even running
rake with 'trace' on didn't helped me much.

 *Virtual Timer Expired* (on executing rake
db:sessions:create or db:migrate)

As I did some googling around, the only suggestion I finding is re-install
or downgrade ruby version. But it is the last thing I would like to do after
progressing this long.

I will be really glad to hear from you, if there is a better solution to fix
this problem.

The details of my current environment are follows:

OS : Ubuntu Jaunty Jakalope
Ruby Version : ruby 1.8.6 (2010-02-05 patchlevel 399) [i686-linux]
Rails Version: Rails 2.3.5
Rake Version: rake, version 0.8.7
Database: mysql  Ver 14.12 Distrib 5.0.75, for debian-linux-gnu (i486) using
readline 5.2

Thanks

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



[Rails] Scriptaculous Problems

2010-05-03 Thread ahmompoint


Hello community,

I am a fairly new RoR programmer and I need some help with
Scriptaculous Drag and Drop:

So I have

<%= draggable_element(@div_id, :revert => "failure", :snap => 5) -%>

and a droppable:

<%= drop_receiving_element(@team_div_id,  :with => "'player=' +
(element.id)+ '&position=' + #{draft_position}" ,:complete =>
visual_effect(:highlight), :update=>"status" , :url => { :action =>
"receive_drop"}, :hoverclass => 'hover' ) %>
<% end %>

I would like to allow the draggable to "snap" to a droppable position
if close or revert back to its original position if it isnt near a
droppable.

I have searched over the net but I have been unsuccessful with this
issue. I understand there's the Snap option but I want it to snap INTO
a droppable when close or go back to its original position.

Can anyone help me with this, or point me in the right position?
Essentially its just "Snap to a grid" but I have been unable to find a
simple example. I appreciate the help!

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



[Rails] Re: Finding the next item, in a group of items.

2010-05-03 Thread Joe
Ok, so I've created my position thing for every tutorial. However now
I need to know how I can setup render :partial to order the tutorials
using the position, and then if two (or more) tutorials have the same
position, then go back and check there id, and order the ones with the
same position by id.

This is how I'm currently displaying the tutorials:

<%= render :partial => @category.tutorials %>

Does anyone have any ideas how I can adapt this?

Thanks In Advance,

Joe

On May 2, 9:18 pm, Joe  wrote:
> Ok, So it seems that this whole tutorial ordering thing seems to be
> the best way to go (thanks to philip anyway for giving me the code to
> do it with ids if I wanted to);
> The problem is I'm really a complete noob in RoR. I know how to create
> migrations, however creating a "position" variable i which they were
> independent to the category the tutorials were in; I have absolutely
> no idea how to do that. And you talk about writing methods, I also do
> not know where these methods would be created (inside a controller
> perhaps?).
>
> Any help with this task would be kindly appriciated,
>
> Thanks In Advance,
>
> Joe
>
> On May 2, 7:18 pm, Philip Hallstrom  wrote:
>
>
>
> > >> The tutorials are then displayed in order of there id (auto-
> > >> incrementing) in their categories show method.
> > >> The thing is, I want to create a link that goes from one tutorial
> > >> (with an id of 10 for example) to the next tutorial in that category
> > >> (which might not have an id of 11, as I create different tutorials at
> > >> different times, therefore creating different ids for two tutorials
> > >> seemingly next to eachother in order).
>
> > >> Obviously I know I will need something like this:
> > >> <%= link_to 'Next lesson',   %>
>
> > >> but I just don't know how I can manage it..
>
> > >> By the way, every tutorial has a: category_id  to determain which
> > >> category they are in (this is an integer).
>
> > > If I were you, i'd create a position column on tutorials, which
> > > determines the ordering of tutorials for a category (ordering by id
> > > might seem the simplest but stops you from ever reordering tutorials.
> > > Given a tutorial, the next one is the first one in the same category
> > > whose position is greater than the current ones (you could write a
> > > next_tutorial method on tutorial). There's a plugin called
> > > acts_as_list that you might find helpful maintaining the position
> > > column. If you're hell bent on ordering by id then it's as if id is
> > > your position column
>
> > > Fred
>
> > I agree with Fred as it allows you to easily re-order the tutorials if  
> > you want to, but if you don't... then...
>
> > next_tutorial = Tutorial.find(:conditions => ["id > ? AND category_id  
> > = ?", current_tutorial_id, current_category_id], :order =>  
> > 'id', :limit => 1)
>
> > prev_tutorial = Tutorial.find(:conditions => ["id < ? AND category_id  
> > = ?", current_tutorial_id, current_category_id], :order => 'id  
> > DESC', :limit => 1)
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-t...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > rubyonrails-talk+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/rubyonrails-talk?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

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