ruby-on-rails

Tips/Suggestions for Building Ecommerce Site In Rails

I'm about to start building my first ecommerce site in Rails. I've coded other projects in Rails, but never done ecommerce. I'd love to hear from people about the best plugins, gems, tricks, tips, or anything else that they found useful in building this sort of site in Rails. Thanks all! ...

setting facility for syslogger in rails to something besides user

I am using the syslog-logger gem in ruby on rails. This, by default, uses a facility called user, and a program called rails. How can I set the facility to be something like 'local0' or 'local1' or any other facility? ...

How are you mapping database records to physical files such as image uploads

37 signals suggests id partitioning to accomplish this thing.. http://37signals.com/svn/archives2/id%5Fpartitioning.php Any suggestions would be more than welcome. Thanks. ...

Rails Functional Tests - I can't assert a template from another controller's view in my functional test.

If controller A's action redirects to another controller B's action, can i check in A's functional test that B's action template is being rendered? in controller As fucntional test i.e. assert_template 'controllerB/some_view' I know that this should be done in controllers Bs tests but I'm wondering if it is technically possible? I ha...

Accessing a resource in routes.rb by using attributes other than Id

I have the following in my routes.rb map.resources :novels do |novel| novel.resources :chapters end With the above defined route, I can access the chapters by using xxxxx.com/novels/:id/chapters/:id. But this is not what I want, the Chapter model has another field called number (which corresponds to chapter number). I want to access...

Backward compatibility issues with json libraries in rails 2.3.4

to_json method in rails 2.0.2 for objects(say user model object with id and name)used to give simple output in the form {"id":"xyz","name":"hello"} But while upgrading the rails to 2.3.4 it gives the output as {"user":{"id":"xyz","name":"hello"}} This is breaking my most of the frontend code. Is there way to get the results in the...

deployment problem on Ruby on Rails

Hi when do the cap deploy for my Ruby on Rails application. i faced the following error. cap deploy * executing `deploy' * executing `deploy:update' ** transaction: start * executing `deploy:update_code' executing locally: "svn info https://digitalsleep.svn.beanstalkapp.com/centralbank/ -rHEAD" svn: /usr/local/lib/libldap_r-2.4....

reading a pdf, adding text/images to it and write the modified pdf in rails

I want to use PDF::writer to put some dates on a calendar sheet. The calendar sheet itself is prepared as a prerendered template in PDF format. How could I read this PDF as template to write text on it? Is there an alternative? Fiddling with an HTML-to-PDF converter (like HTMLDoc) is no option. ...

Problem with has_many :through and fields_for.

Hi There, I have a pretty basic association: # user.rb class User < ActiveRecord::Base has_many :services, :through => :subscriptions has_many :subscriptions, :accessible => true accepts_nested_attributes_for :subscriptions end # service.rb class Service < ActiveRecord::Base has_many :users, :through => :subscriptions has_ma...

rails - how to dynamically add/override wording to i18n yaml

as an example, i have a default english locale file "en.yml" with contents: en: messages: messages users: users now, there is a customer which wants messages to be named discussions in his product, but users should remain users. so what i want to do is to create "customer.en.yml" file en: messages: discussions which would ove...

Resuming file downloads in Ruby on Rails (Range: header support)

Hi guys, I am trying to make my Rails app support resuming of downloads, since we serve quite large files from there. I found a piece of middleware to do this long ago, but I cant find it again. Any tips/tricks on how to pull it off? Thanks! :) ...

ActiveResource 500 Internal Server Error

I am getting a really strange error from ActiveResource. I have a method that calls another system to get a list of products. The list is quite large and takes about 3 minutes to generate and transfer. Since this is really only a once a day kinda thing I built a rake task to run it. In production whenever I run the rake task it fails ...

mysqlplus is better adapter than ruby mysql?

I want to know if the mysqlplus gem is a better database driver than the common Ruby mysql gem? I used to have some problems in my Rails application, like: ActiveRecord::StatementInvalid: Mysql::Error: MySQL server has gone away ...

ActiveScaffold on Heroku's read-only file system?!!

ActiveScaffold apparently creates public/blank.html every time the server starts, even if that file already exists (so adding it to version control doesn't help). This is causing my application to fail to boot on Heroku, since they have a read-only file system. Can someone please tell me how to prevent this behavior or work around it s...

Rails, OAuth, and CSRF protection

I am using REST and OAuth to talk to a Rails app (from an iPhone app, but that should not be relevant). However, I am running into some issues with Rails' CSRF protection (via protects_from_forgery). I understand that CSRF protection only kicks in for regular form submissions (i.e. Content-Type=application/x-www-form-urlencoded), so I w...

Validate website ownership in rails

For a more recent discussion about a similar topic check this question out. Hi all, Hoping someone can help me out with this one: What's the best way to validate whether a particular user has ownership of a website? Let's say you had this model: class User < ActiveRecord::Base has_many :websites end In order to make sure the Us...

Eager Loading with Entity Framework and Asp .net mvc (From a rails background)

I have a few tables that reference the same table. For example: Person has an address. Business has an address. When using the models I would like to do this in the controller: person.Address.Zip business.Address.Zip I'm coming from a rails background where I can just declare a relationship and have all the above functionality. Forc...

Authenticating a User In a Separate Controller with Restful_authentication

...

Rails + C# - Reusing Models

I'm working on a project that has a website in Rails and a C# GUI that use the same database and data models. I'd like to share the (active)models between the two parts. Any ideas on how this is possible? ...

Ruby script to grab lyrics?

Anyone have a Ruby script to grab some lyrics from somewhere? ...