Re: [Rails] Call a controller from the rake file

2012-01-25 Thread Colin Law
On 25 January 2012 05:39, amvis vgrkrish...@gmail.com wrote: How to call a controller from  the rake file, Just i have tried  to create a controller object in rake, and call the method, but i didn't get that... also how to link the helper class with the rake? I don't believe it makes sense to

Re: [Rails] Call a controller from the rake file

2012-01-25 Thread amvis
can i use like this.. *myrake file* task :my_task = [:environment] do rd=*MofobirakesController*.new rd.index end *Controller file* * * * * class *MofobirakesController* ApplicationController def index puts hai rails3 end end what is the difference in that way to do in controller and in

[Rails] mysqlerror for mongodb documents in testenvironment

2012-01-25 Thread Lucky Nl
Hi friends, Am using mysql and mongodb in my application. I have create mongodb models for 2 tables books and books_history after created these , am running test cases for previously written controllers which are not using mongodb tables then am getting this error

Re: [Rails] Call a controller from the rake file

2012-01-25 Thread Colin Law
On 25 January 2012 08:36, amvis vgrkrish...@gmail.com wrote: can i use like this.. myrake file task :my_task = [:environment] do   rd=MofobirakesController.new   rd.index end Controller file class MofobirakesController  ApplicationController def index puts hai rails3 end end

Re: [Rails] Re: redirect_to :back - Any way to go back two pages?

2012-01-25 Thread Peter Vandenabeele
On Wed, Jan 25, 2012 at 12:27 AM, Dave Aronson googlegroups2d...@davearonson.com wrote: Just don't dare top-post, without nomex on. ;-) Dave, thanks for the hint :-) Don, sorry for being pedantic. Peter -- You received this message because you are subscribed to the Google Groups Ruby on

Re: [Rails] Scope in Rails model vaidation

2012-01-25 Thread Colin Law
On 25 January 2012 06:49, angel david li...@ruby-forum.com wrote: Hi all, I have a requirement were the following is to be done: A user can belong to single chapter. Chapter has many channels.. So a particular user can only be a part of a single chapter. How can i do this validation in

Re: [Rails] Multiple downloading

2012-01-25 Thread Colin Law
On 25 January 2012 07:24, Deepika Vummiti li...@ruby-forum.com wrote: Hi,  I'm downloading many files at a time, i wants to show the list of files downloading in pop up. For ex: Downloading file 1 of 12 etc. Anyone please help this, how to do this in rails 2.3.14.  Is the filemanager gem is

[Rails] Re: Multiple downloading

2012-01-25 Thread Deepika Vummiti
Am downloading multiple files at a time. Using Zip file format. How are you downloading multiple files at a time? Colin -- 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,

Re: [Rails] serializable_hash and serializable_add_includes

2012-01-25 Thread Peter Vandenabeele
On Wed, Jan 25, 2012 at 7:35 AM, Jacob H. li...@ruby-forum.com wrote: I'm trying to write a helper method similar to attr_accessible but instead it will be used to whitelist which attributes are available for serialization (attr_serializable). My first attempt at this was to override

Re: [Rails] Re: Multiple downloading

2012-01-25 Thread Colin Law
On 25 January 2012 09:18, Deepika Vummiti li...@ruby-forum.com wrote: Am downloading multiple files at a time. Using Zip file format. Please don't top post, it makes it difficult to follow the thread. Insert your reply at appropriate places in the previous message. Thanks. The processes of

[Rails] Re: Re: Multiple downloading

2012-01-25 Thread Deepika Vummiti
Colin Law wrote in post #1042447: On 25 January 2012 09:18, Deepika Vummiti li...@ruby-forum.com wrote: Am downloading multiple files at a time. Using Zip file format. Please don't top post, it makes it difficult to follow the thread. Insert your reply at appropriate places in the previous

[Rails] Re: WEB SERVICES

2012-01-25 Thread Bala TS
Hai! http://www.ibm.com/developerworks/opensource/library/os-ws-rubyrails/index.html Bye:) bdeveloper01 -- 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

[Rails] Re: Invalid associated child object is silently not auto-saved and does not make saving of parent fa

2012-01-25 Thread Bala TS
Hai! One-to-one use has_one in the base, and belongs_to in the associated model. class Parent ActiveRecord::Base has_one :child end class Child ActiveRecord::Base belongs_to :parent# foreign key - parent_id end Try this way: Bye:) Bdeveloper01 -- Posted via

Re: [Rails] mysqlerror for mongodb documents in testenvironment

2012-01-25 Thread Siva Prasad
looks like the controller is assuming that the book_history table in mysql's db. have you specified the app to talk with mongodb. other things like update and all worked for this tables? my opnion is they might not work as well. Thanks, Siva On 1/25/2012 2:16 PM, Lucky Nl wrote: Hi friends,

[Rails] Paperclip preserve files ?

2012-01-25 Thread Venkat Surabhi
Hi, I am using paperclip to upload files. The problem I am facing is, based on my object property I need to preserve my file. Means my object should be deleted from db but the file need to be restored. I am using the option :preserve_files = true. If I keep the above option in

[Rails] Rmagick image clarity

2012-01-25 Thread angel david
Hi all, Im using Rmagick to resize an image. But after resizing, the clarity of original image is not retrieved. So anyone help me in how to restore the clarity of image after resizing? Im using rails 3 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are

Re: [Rails] Call a controller from the rake file

2012-01-25 Thread amvis
Basically i need to write one cron job for running the rake file from which, i'll call one class, that have one query which will take data from some tables and will put into another tables. This is my objective. But now created one *.rb file in lib/ directory and created one .rake in task/

Re: [Rails] Re: Invalid associated child object is silently not auto-saved and does not make saving of parent fa

2012-01-25 Thread Peter Vandenabeele
On Wed, Jan 25, 2012 at 11:31 AM, Bala TS li...@ruby-forum.com wrote: Hai! One-to-one use has_one in the base, and belongs_to in the associated model. class Parent ActiveRecord::Base has_one :child end class Child ActiveRecord::Base belongs_to :parent# foreign key - parent_id

Re: [Rails] Call a controller from the rake file

2012-01-25 Thread Colin Law
On 25 January 2012 11:55, amvis vgrkrish...@gmail.com wrote: Basically i need to write one cron job for running the rake file from  which, i'll call one class, that have one query which will take data from some  tables and will put into another tables. This is my objective. But now created one

Re: [Rails] Re: Invalid associated child object is silently not auto-saved and does not make saving of parent fa

2012-01-25 Thread Peter Vandenabeele
On Wed, Jan 25, 2012 at 1:15 PM, Peter Vandenabeele pe...@vandenabeele.comwrote: On Wed, Jan 25, 2012 at 11:31 AM, Bala TS li...@ruby-forum.com wrote: Hai! One-to-one use has_one in the base, and belongs_to in the associated model. class Parent ActiveRecord::Base has_one :child end

[Rails] Re: One to many query for 3 tables

2012-01-25 Thread Clem Rock
Peter - big thanks for your help. You were right - I meant to say the layouts table can have many photos Looks like this was the winner for me: @properties = Property.paginate(:page = params[:page], :per_page = 20).includes(:photos).includes(:layouts).order(properties.modify_date,

Re: [Rails] Re: One to many query for 3 tables

2012-01-25 Thread Peter Vandenabeele
On Wed, Jan 25, 2012 at 1:35 PM, Clem Rock li...@ruby-forum.com wrote: Peter - big thanks for your help. You were right - I meant to say the layouts table can have many photos Looks like this was the winner for me: @properties = Property.paginate(:page = params[:page], :per_page =

[Rails] Re: css.scss file changes don't do anything now

2012-01-25 Thread Dave Castellano
Dave Castellano wrote in post #1042404: No, that didn't help. I would assume rails uses the uncompiled files in development env as those are the files that are edited in development (app/assets/stylesheets/***) The compiled files are in the public folder and not in an easily editable

[Rails] Cancan gem help .. as I Can..not ;-)

2012-01-25 Thread Erwin
I'll be grateful to any cancan guru to give me some advice on how to formulate the abilities in a structure with associations ... I have the following tree association : Subdomain (has_one) Portfolio (has_many) Projects (has_many) Payments Subdomain (has_many) Users (w roles) I want a

[Rails] Average hour rate for a Junior Rails developer.

2012-01-25 Thread Agis A.
Hi guys. I would like to ask what would be the average hour rate for a junior rails dev in the US and then in Europe like UK Germany. Basically, where is considered the best country to work in as a Rails developer? Where are the most rewarding job opportunities? And how is Junior defined in

Re: [Rails] Average hour rate for a Junior Rails developer.

2012-01-25 Thread Greg Akins
On Wed, Jan 25, 2012 at 9:40 AM, Agis A. corestudios...@gmail.com wrote: Hi guys. Basically, where is considered the best country to work in as a Rails developer? Where are the most rewarding job opportunities? Funny.. the same discussion is going on in #rubyonrails now -- Greg Akins

Re: [Rails] Average hour rate for a Junior Rails developer.

2012-01-25 Thread Peter Hickman
Hourly rate? Hourly rates are for consultants and the phrase junior consultant has little cachet. Everyone else has salary. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to

[Rails] Re: Sending custom headers in Find method in ActiveResource:Base

2012-01-25 Thread Nadeem J. Qureshi
This guy understood my problem, and answered accordingly: http://prblm.aakashd.com/rails-activeresource-httpauthorization-header -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

[Rails] Re: serializable_hash and serializable_add_includes

2012-01-25 Thread Jacob H.
Peter Vandenabeele wrote in post #1042445: On Wed, Jan 25, 2012 at 7:35 AM, Jacob H. li...@ruby-forum.com wrote: model1.to_json(:include = {:model2 = {:only = [:some_other_property]}, :only = [:id]) Can someone please explain to me why it works this way. The code in

Re: [Rails] Re: Rails doesn't scale?

2012-01-25 Thread Rodrigo Ruiz
Like I didn't google it first... On Wed, Jan 25, 2012 at 3:22 AM, Robert Walker li...@ruby-forum.com wrote: Rodrigo Ruiz wrote in post #1042405: Does Rails scales for something like an e-commerce that makes 5000 sells each day? An e-commerce like ebay, for example. So how does 5000

Re: [Rails] Re: Rails doesn't scale?

2012-01-25 Thread Javier Quarite
http://canrailsscale.com/ :) -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to

[Rails] Re: Rails doesn't scale?

2012-01-25 Thread Rolando
:) On Jan 25, 9:13 am, Javier Quarite jquari...@gmail.com wrote: http://canrailsscale.com/ :) -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from

[Rails] Re: Rails doesn't scale?

2012-01-25 Thread Rolando
I think it will. On Jan 24, 9:04 pm, Rodrigo Ruiz rodrigo.ru...@gmail.com wrote: Hi everyone, I'd like an opinion. Does Rails scales for something like an e-commerce that makes 5000 sells each day? An e-commerce like ebay, for example. Thanks in advance. Ps.: I wanna convince my team

Re: [Rails] Re: Rails doesn't scale?

2012-01-25 Thread Peter Hickman
Given your rather hopeless metric of 5000 transactions a day gives us one transaction every 17 seconds. I think an arthritic snail with a pencil could cope with that. You would be hard pressed to find a programming language that couldn't. If this is a serious question then some better metrics

[Rails] Re: How to maintain multiple versions of rails in one PC

2012-01-25 Thread Rolando
pik on windows. On Jan 24, 6:16 am, honey ruby emailtohoneyr...@gmail.com wrote: hey everyone i am using rails 2.3.8 and ruby 1.8.7 . i want  to install rails 3 so how can i maintain 2 versions of rails in my pc. i wanna learn rails 3 and can any tell the major difference in 2.3.8 and rails

Re: [Rails] Re: Rails doesn't scale?

2012-01-25 Thread Jordan Miller
http://railslab.newrelic.com/scaling-rails lots of technical details in these webcasts... jordan On Jan 25, 2012, at 12:22 AM, Robert Walker wrote: Rodrigo Ruiz wrote in post #1042405: Does Rails scales for something like an e-commerce that makes 5000 sells each day? An e-commerce like

Re: [Rails] Re: serializable_hash and serializable_add_includes

2012-01-25 Thread Peter Vandenabeele
On Wed, Jan 25, 2012 at 4:03 PM, Jacob H. li...@ruby-forum.com wrote: Peter Vandenabeele wrote in post #1042445: On Wed, Jan 25, 2012 at 7:35 AM, Jacob H. li...@ruby-forum.com wrote: model1.to_json(:include = {:model2 = {:only = [:some_other_property]}, :only = [:id]) Can someone

[Rails] Optimizing query

2012-01-25 Thread Linus Pettersson
Hi! I'm trying to speed up some queries in my app, running Rails 3.2 and need some help. I'm running the app at Heroku on postgresql. I'm new to postgresql and need some help to optimize a query so it effectively uses indices. This is the query I'm currently working on:

[Rails] Re: Rmagick image clarity

2012-01-25 Thread Jim
I'm using rmagick to do lots of production work with images, including resizing. Without more details I'm afraid there's not much anyone can tell you. What exactly are you trying to do? Jim Crate -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk

[Rails] Re: Optimizing query

2012-01-25 Thread Jim
Would probably help if you posted the generated SQL as well as the output of EXPLAIN ANALYZE, which shows not just what the planner thinks the costs are, but what the costs actually were. You could also try running ANALYZE on the tables in question, or ANALYZE VERBOSE and checking if the

Re: [Rails] Re: serializable_hash and serializable_add_includes

2012-01-25 Thread Peter Vandenabeele
On Wed, Jan 25, 2012 at 4:55 PM, Peter Vandenabeele pe...@vandenabeele.comwrote: On Wed, Jan 25, 2012 at 4:03 PM, Jacob H. li...@ruby-forum.com wrote: Peter Vandenabeele wrote in post #1042445: On Wed, Jan 25, 2012 at 7:35 AM, Jacob H. li...@ruby-forum.com wrote:

Re: [Rails] Re: Rails doesn't scale?

2012-01-25 Thread Rodrigo Ruiz
I think it would be something like 200 requests/minute. Is it ok for rails to handle? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group,

Re: [Rails] Average hour rate for a Junior Rails developer.

2012-01-25 Thread Dave Aronson
On Wed, Jan 25, 2012 at 09:40, Agis A. corestudios...@gmail.com wrote: Basically, where is considered the best country to work in as a Rails developer? Where are the most rewarding job opportunities? From the numbers of opportunities I've seen, definitely the USA, but that's partly because we

[Rails] Re: both with_index and each_with_index not working

2012-01-25 Thread John Merlino
Maybe the title of this post sounds crazy but its true. - iterate_for(@reports) - @reports.to_enum.with_index(1).each do |r, i| - r.alerts.reverse.each do |a| - if a.code == 14 %tr %td.num_col Trip #{i} - elsif a.code == 15

[Rails] Re: Ruby update

2012-01-25 Thread CiriusMex
On Jan 24, 11:32 pm, Norm Scherer normsche...@earthlink.net wrote: On 01/24/2012 10:05 PM, Norm Scherer wrote: On 01/24/2012 10:33 AM, CiriusMex wrote: Hello, I'm using instantrails 2 to develop RubyOnRails projects on windows and need to update my ruby version to 1.8.7 (I'm still using

[Rails] Re: both with_index and each_with_index not working

2012-01-25 Thread John Merlino
After typing second message, I realized the nested loop was causing the issue. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send

Re: [Rails] Re: redirect_to :back - Any way to go back two pages?

2012-01-25 Thread Don
FYI, Attached is a screen shot of how I see your 3 recent mails in Gmail. To me they seem like 3 short messages without context. I think you could get more help/feedback if you leave a little context quoted above, showing to what you are actually responding. Thanks Peter.

[Rails] Re: Optimizing query

2012-01-25 Thread Linus Pettersson
Thank you. I have added the generated SQL to the snipt in my first post. Regarding the EXPLAIN ANALYZE, can I somehow run that on Heroku? I'm using their shared database so I don't have access to any psql console... I did run it on my local machine though. The thing is that it differs in

Re: [Rails] Re: Optimizing query

2012-01-25 Thread Peter Vandenabeele
On Wed, Jan 25, 2012 at 8:20 PM, Linus Pettersson linus.petters...@gmail.com wrote: Thank you. I have added the generated SQL to the snipt in my first post. Regarding the EXPLAIN ANALYZE, can I somehow run that on Heroku? I'm using their shared database so I don't have access to any psql

Re: [Rails] Re: Optimizing query

2012-01-25 Thread Linus Pettersson
Well, maybe it's not necessary... It is the slowest of my queries as far as I can see anyway. I'm using Rails 3.2 and I have enabled automatic EXPLAIN on slow queries (0.5s). This query is currently being explained in my console when I run it on my localhost. SQL (556.5ms) ... 556.5ms seems a

[Rails] Re: redirect_to :back - Any way to go back two pages?

2012-01-25 Thread Tim Shaffer
If you can do it in JavaScript, you can always just do window.history.go(-2) -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/84XQPpvPqsEJ. To post

[Rails] Re: Re: Rails doesn't scale?

2012-01-25 Thread Robert Walker
Rodrigo Ruiz wrote in post #1042519: I think it would be something like 200 requests/minute. Is it ok for rails to handle? If it couldn't then you would not be asking this question. Nobody would have even ever heard of Rails. Notice in the following article they talk in terms of thousands of

Re: [Rails] Re: Re: Rails doesn't scale?

2012-01-25 Thread Rodrigo Ruiz
Thank you On Wed, Jan 25, 2012 at 6:01 PM, Robert Walker li...@ruby-forum.com wrote: Rodrigo Ruiz wrote in post #1042519: I think it would be something like 200 requests/minute. Is it ok for rails to handle? If it couldn't then you would not be asking this question. Nobody would have

[Rails] anyway to parse a localized date string into a Date object ?

2012-01-25 Thread Erwin
From my form , using jQuery Datepicker , I get dates in textfields already formatted as : Parameters: { project={ start_shooting_date=Mercredi 1 Février, 2012, latest_publish_date=Mercredi 8 Février, 2012}...} is there any way to parse and convert these dates ? there is a trick: I can store

Re: [Rails] Re: Optimizing query

2012-01-25 Thread Peter Vandenabeele
On Wed, Jan 25, 2012 at 8:51 PM, Linus Pettersson linus.petters...@gmail.com wrote: Well, maybe it's not necessary... It is the slowest of my queries as far as I can see anyway. I'm using Rails 3.2 and I have enabled automatic EXPLAIN on slow queries (0.5s). This query is currently being

Re: [Rails] anyway to parse a localized date string into a Date object ?

2012-01-25 Thread Ahmy Yulrizka
Checkout http://ruby-doc.org/stdlib-1.9.3/libdoc/date/rdoc/Date.html#method-c-parse assuming you use 1.9.3, there is also #strptime Ahmy Yulrizka On Thu, Jan 26, 2012 at 4:55 AM, Erwin yves_duf...@mac.com wrote: From my form , using jQuery Datepicker , I get dates in textfields already

Re: [Rails] WEB SERVICES

2012-01-25 Thread Adrian Caceres
I think to deploy the server side of a RESTful web service, the built-in support in rails is pretty good. Support for building the client side (ie. consuming a web service) is still not great. You can try using activeResource which promises a similar model as activeRecord but with a web

[Rails] Re: WEB SERVICES

2012-01-25 Thread gerbdla
Our implementation is pretty simple. in routes.rb build a match route like so: match '/data_import/input(.:format)' = 'import_data#xml_received' create an imports controller then you can create a method that will receive the xml def receive_xml end then you can pass that data using a curl

Re: [Rails] WEB SERVICES

2012-01-25 Thread Simon Macneall
We use soap4r for consuming simple web services, Handsoap for slightly more complex services, and for some truly evil IBM web services, we rolled a custom java command line app that we called from rails. Simon On Thu, 26 Jan 2012 07:46:36 +0800, Adrian Caceres cacere...@gmail.com wrote:

[Rails] Re: anyway to parse a localized date string into a Date object ?

2012-01-25 Thread Erwin
Thanks , I already tried that , but it's a localized string... Date.parse(Mercredi 1 Février, 2012) even if the I18n.locale = :fr ( french) it raises an error = ArgumentError: invalid date On Jan 25, 11:48 pm, Ahmy Yulrizka ahmy...@gmail.com wrote: