ruby-on-rails

What options other than BitNami are there for easy Rails stack deployments?

I've been having some odd issues with BitNami, especially when trying to deploy it on a system that already has a Rails stack elsewhere. I'd like to know what the alternatives are (if any) for easy deployment like the stacks BitNami offers. If nothing else, it'll just be neat to shop around. :) ...

What's the difference between a ViewModel and Controller?

What are the responsibilities of one vs the other? What kind of logic should go in one vs the other? Which one hits services and databases? How do I decide if my code should go in the viewmodel or the controller? For the record, I am using ASP MVC, but since the question is architectural, I do not believe it matters what language or fra...

db:migrate without loading models

Is it possible to do a "rake db:migrate" or "rake db:schema:load" without it loading all my models first? I'm using the acts_as_solr plugin, and it requires that the table exists before the model can be loaded. This is probably a bug in acts_as_solr, but the only workaround I found is to uncomment the acts_as_solr line in my model, run ...

New Rails App - Handling Account Settings

Hello all, I am building a new Rails-based application that will have Basecamp-like accounts for each subdomain. Each account (client/customer) should be allowed to store different settings such as a color scheme, their subdomain, their preferred authentication mechanism and so forth. So, how should I handle the settings for each accou...

how to capture the result of `git status` in a Rails action?

If you run this code in a controller action (notice the backticks) def index … `pwd >> tc.log` `git status >> tc.log` `ls >> tc.log` … end , only the 1st and 3rd command will pipe their output to the tc.log file. I'm trying to get the output of git status (f.ex) in a controller action and have tried many variations (captur...

Rails date/time picker (hopefully jquery)

Looking for a date and datetime picker that will integrate fairly seamlessly with Rails. I'm sure some people must be using something similar. I have tried the unobtrusive date picker plugin but it breaks with the latest release of Rails. calendar date select plugin uses prototype which I have removed from my app and don't want to ad...

Rails User model has_many activities (observer) but should also be observed

I'm running into an issue with an existing ActiveRecord::Observer model that records various Activities of a User the site. Everything was working really well, until I tried to observe the User class with the same Activity model that it uses to observe other models. Consider that: class Activity < ActiveRecord::Base belongs_to :user b...

Rails test fixtures vs uniqueness

In Rails, fixtures records seem to be inserted & deleted in isolation for a given model. I'd like to test having many objects/rows in one transaction, eg. to check uniqueness. How to do it? ...

cant install rails in ubuntu 9.10 in my eee pc

i am trying to install rails in my eee pc with the last version of ubuntu and i have some package that are told installable.how is it possible?i can even install gem fenec@fenec-laptop:~$ gem The program 'gem' can be found in the following packages: * rubygems1.8 * rubygems1.9.1 Try: sudo apt-get install <selected package> gem: comman...

Great Ruby on Rails resources

I'm generally a PHP dev, but over the past few months I have been dying to get into a new language. I have tried everything, I learned a little Java, not for me; a little Python, I dislike the syntax, I wanted to try Perl, but never got around to it. On the other hand I started to read an ebook on Ruby, and I really like the language, I'...

Constant: Rails::VERSION::STRING

I know how to find the version of rails I have: > Rails::VERSION::STRING > "2.3.2" Can someone breakdown/explain Rails::VERSION::STRING" for me? What is the first part "Rails"? What does the "::" mean/do? Is this a global constant? How is this different from "RUBY_VERSION"? (construction, not meaning. ie no "::") How can I list/fi...

RSS feed from MySQL table using either Ruby or Rails or Gems

I have a MySQL table and I want to pick certain columns to create RSS Feed from it. How to do it using Ruby or Rails or Gems? ...

change the name of returning field with errors in rails

I have a form like this : <fieldset> <legend> اضافه کردن یک قالب </legend> <%= error_messages_for 'theme' , :header_message => "موارد زیر دارای اشکال می باشند، لطفا دوباره بررسی نمایید :" , :message => nil %> <ol> <% form_for @theme do |t| %> <li> <%= label :theme , :نام %> ...

Help installing mysql and postgres gems via Bundler

I'm an experienced developer, but a complete Rails newb. I'm trying to install an existing app that uses the Bundler gem to encapsulate and control the application environment and, after about 3 days of fighting with it, I can't seem to get the environment put together. The bundler Gemfile specifies the use of both mysql and postgres bec...

unicode regular expression in rails

how can i create regular expression in rails for unicode characters ? ...

Do I need any special method for making rails recognize data type in db ?

I create variables model which have two attributes name and value for saving any options in my site. What I want to know is do I need any special method like serialize to make rails recognize data type after it read or before it write to db ? I try it without serialize :value but only data type work are array hash and string the others ...

How to manage non-autoincrement primary key in Rails?

I have lots of situations where I'd like to have a non-autoincrement primary key when using Rails. Example: I have one-to-one relationship between A and B. B describes some specific features added to A thus can't exist without A. So we have: A has one B B belongs to A The natural thinking would be having B.A_id as primary key. So I ...

plugin to capture a site page preview

I think I've seen a plugin that does this but I can't find it now! I'm trying to capture a page preview image for a bookmarklet I'm building. So when a user bookmarks a site I can have a little snaptshot of the page Do you know what plugin I am talking about? Thanks! As in this page http://www.stumbleupon.com/discover/toprated/ ...

unit test in rails - model with paperclip

I'm trying to write a test for a model with a picture, using paperclip. I'm using the test framework default, no shoulda or rspec. In this context, how should I test it? Should I really upload a file? How should I add a file to the fixture? ...

Using deprec with passenger and nginx

Has anyone come up with a recipe for installing Phusion Passenger fronted by nginx instead of Apache? Or at least some automated way of installing those two, that works alongside a cap/deprec deploy? ...