Re: [Rails] Re: rspec - bash: rspec: command not found

2010-09-02 Thread Aleksey Gureiev
Do you have RSpec installed (not as a bundler gem)? Bundler won't install binaries for you -- will just load the correct Ruby classes. Try installing RSpec with "gem install rspec" or "sudo gem install rspec" (keep an eye on the gem version) and try again. - A On 02/09/2010, at 6:29 PM, nobosh

Re: [Rails] Re: Rails 3 web server quits with error message on booting

2010-09-02 Thread Aleksey Gureiev
Paul, It looks like at some point when you started copy-pasting examples you got tired and stopped paying attention to explanations. Have a some rest, man. Dots alone are not a valid Ruby expression for sure. It's all Ruby out there and has to comply. - A On 02/09/2010, at 2:34 PM, pauld wro

[Rails] Re: belongs_to_auto_completer > undefined method `reflect_on_association'

2010-09-02 Thread Aleksey Gureiev
Is it just me or no one can see the link fully? - A On Sep 2, 2:02 pm, tom wrote: > anyone? please help me. thx > > > > On Wed, Sep 1, 2010 at 6:24 PM, tom wrote: > > > hi, im using > > > ModelAutoCompleterHelper > > (http://model-ac.rubyforge.org/classes/M… elper.html) > > > and getting the er

Re: [Rails] Re: Progressbar for Slow Loading Webpages

2010-09-02 Thread Aleksey Gureiev
> How about putting some effort into getting the pages to load quicker? Exactly my thought. If you want to load something huge (what that could be?), load a really small screen first with some "welcome. please wait" and then make a background call for everything else. But it would definitely be

Re: [Rails] Remove array within hash

2010-09-02 Thread Aleksey Gureiev
Come on, why even ask this!? Check the doc for all essentials -- Array, Hash, String. hash.each { |k,v| hash[k] = v[0] } - A On 02/09/2010, at 1:49 PM, Manivannan Jeganathan wrote: > My orginal hash is like as > > ==> hash = {"sku_id"=>[4], "brand_active"=>["true"], > "salesman_active"=>["tru

Re: [Rails] Re: Read embedded image from xml file

2010-09-02 Thread Aleksey Gureiev
using Base64 to decode it but my main issue > is as you say understanding > what format it was decoded in the first place. Please find a sample > attached > > thanks > > JB > > > > Aleksey Gureiev wrote: >> How the image is encoded into XML? Can you gi

[Rails] Re: How to override form_helper module

2010-09-02 Thread Aleksey Gureiev
Greg, There's plenty of tutorials that you can find in Google: http://ramblingsonrails.com/how-to-make-a-custom-form-builder-in-rails http://onrails.org/2008/06/13/advanced-rails-studio-custom-form-builder http://stackoverflow.com/questions/2623250/custom-form-helpers ... and more generally: ht

[Rails] Re: Read embedded image from xml file

2010-09-02 Thread Aleksey Gureiev
How the image is encoded into XML? Can you give an example? Is it a CDATA section with Base64 or something else? If it's a known encoding, you just read it as an attribute / tag value and then decode using an appropriate decoder, then open the file in binary mode and save the decoded version there

[Rails] Re: Where to put large application controller code

2010-02-08 Thread Aleksey Gureiev
at knows how to work with data. Isolate your code in it, test it with unit tests and call from your skinny controller. - Aleksey On Feb 8, 7:01 pm, Aleksey Gureiev wrote: > Hi Martin, > > That's a pretty common situation that you describe. One way, which is > adopted by Rails team

[Rails] Re: Where to put large application controller code

2010-02-08 Thread Aleksey Gureiev
Hi Martin, That's a pretty common situation that you describe. One way, which is adopted by Rails team is to factor your related methods in modules and include them in your controllers. You can put those modules near your controllers or under /lib (which is loaded automatically). But before doing

[Rails] Re: ror developers

2010-01-23 Thread Aleksey Gureiev
. These are way more important than any specific technologies. - Aleksey On Jan 23, 4:37 am, Matt Jones wrote: > On Jan 21, 5:12 pm, Aleksey Gureiev wrote: > > > You guys are surprising me. So you are looking for developers and you > > don't know what you need from them.

[Rails] Re: Fitting two step creation in to a resource based design

2010-01-21 Thread Aleksey Gureiev
Correct me if I'm wrong, but what you are really looking for is just an address lookup step in the middle of the model creation process. Why don't you start with the Customer#new that shows the zip code field only at first. The user enters the code and you send an Ajax call to the CustomersControll

[Rails] Re: How to generate OR conditions in a scope

2010-01-21 Thread Aleksey Gureiev
Hi Ginty, I think it's as simple as this: @items = Item.all(:conditions => [ "office_id = ? OR (company_id = ? AND shared = 1)", current_office.id, current_company.id ]) - Aleksey On Jan 21, 2:05 pm, Ginty wrote: > Hi All, > > I see that named scopes can be used to inject additional AND > cond

[Rails] Re: ror developers

2010-01-21 Thread Aleksey Gureiev
You guys are surprising me. So you are looking for developers and you don't know what you need from them. Given that someone said it's, for example, RSpec that they need to know well, how would you to assess the prospective developer? Does anyone around you know RSpec well enough, or will you take

[Rails] Re: Redirect www to non-www

2010-01-21 Thread Aleksey Gureiev
If you use Apache as a web server, there are plenty of .htaccess tricks to do just that. Google around a bit. Aleksey On Jan 21, 2:02 pm, Johnny Shi wrote: > How to redirect www to non-www? e.g redirectwww.example.comto > example.com > > Thanks > > Johnny -- You received this message because yo

[Rails] Re: Difference between ruby1.8.6 and 1.8.7

2010-01-21 Thread Aleksey Gureiev
Hi Tom, >From what I know, Rails 3 won't work with Ruby 1.8.6. There's a fix in Ruby 1.8.7 they count on. Aleksey On Jan 21, 3:50 pm, Tom Mac wrote: > Hi >     I am using ruby1.8.6 for development in fedora12 since in yum > repository the latest is that. Is there any problem if continuing with

[Rails] Re: scope problem in controller

2010-01-20 Thread Aleksey Gureiev
Exactly right. "return" alone will always return "nil". Aleksey On Jan 21, 9:28 am, "Jeffrey L. Taylor" wrote: > Quoting byrnejb : > > > > > > > I am clearly misunderstanding something fundamental about ruby methods > > and the return statement. > > > I have finally gone for the blunt force sol

[Rails] Re: Rails 3 Problem: no such file to load -- rails (LoadError)

2010-01-20 Thread Aleksey Gureiev
You need to bundle your rails into the Rails 3 app. Did you do that? Also make sure that if you use multiple versions of Ruby, you will need either to re-bundle your gems under the one you decided to use after switching, or to add a symlink in vendor/gems/ruby. Hope it solves the problem. Alekse

[Rails] Re: mysql problem

2010-01-20 Thread Aleksey Gureiev
I have a couple of other Seg Faults in 1.8.7p284, so you are not alone. :) Try switching to 1.9.1 or alike. Or take a step back to 1.8.6 (if you don't need Rails 3). If unsure how to switch ruby versions -- use RVM. - Aleksey On Jan 20, 10:57 pm, Alex Thiakos wrote: > Hello guys, > > Im new in

[Rails] Re: Tutorial - Creating a Global REST Controller

2010-01-18 Thread Aleksey Gureiev
Interesting tutorial. Thanks. I found there are a couple of little problems. First, your index view code has some extra closing round brackets, and then the destroy action redirects back to the deleted object. I took a little while to fork and update the controller code. Also made it a bit more DR

[Rails] Re: MVC .... Many views and one controller

2010-01-18 Thread Aleksey Gureiev
I would second Colin's suggestion. Basically, you use some clue (URL parameter, session, database state or any external data) to decide what to render at the moment. If I needed such a thing, my approach would be to have several index partials or templates that I would render selectively. The nami

[Rails] Re: sessions

2010-01-18 Thread Aleksey Gureiev
Hi Jorge, First of all, you mention that you have to give usuario_id manually every time you create a post. This doesn't sound right at all to me. Do you create a post from the name of a user who is currently logged in? If so, you have his usuario_id in the session, don't you? In the post#create a

[Rails] Re: Loading Seed Data from MySQL exported file

2010-01-18 Thread Aleksey Gureiev
I believe, converting of data to the seed.rb format is not an option? If so, the easiest way would be to write a rake task to use mysql or sqlite3 to upload your data. Here's the sample that I put together quickly: http://gist.github.com/279918 It replaces the standard db:seed with the SQL-based v

[Rails] Re: Comment syntax and strange partial rendering

2010-01-18 Thread Aleksey Gureiev
The result is pretty much expected. Since you started the general Ruby code block, the closing "%>" is now the part of the comment and doesn't denote the code block end any more. To see the difference, try: <% # Comment %> - Aleksey On Jan 18, 7:47 pm, Colin Law wrote: > 2010/1/18 Benjamin R

[Rails] Re: Ruby Array to Java Script Array

2010-01-18 Thread Aleksey Gureiev
Use array.to_json and send it over to the client. For example, you could use an AJAX call to do that. - Aleksey On Jan 18, 5:30 pm, Prashant wrote: > Hi, > > How can we use an array created in Ruby in Java script ? > > Regards, > Prashant -- You received this message because you are subscribed