ruby-on-rails

Ruby and Ruby on Rails crash course syllabus

I intend to design an induction plan or you can say a crash course syllabus for developers starting to learn Ruby and Ruby on rails. I am not sure about number of topics to be covered (And the depth of coverage) as this is a 3 day course (24 to 27 hours). Also, newbies tend to compare ruby with existing object oriented programming vetera...

database modeling mac app for ruby on rails development

Hello, I am building web applications using Ruby on Rails and I would like to know what's the best tool for OS X to mock a new application from a functionality perspective and not graphic design. I would like to be able to get an idea of what the application will require in terms of resources before starting to write the code. Thanks, ...

How to alias ActiveRecord class methods dynamically in a rails plugin?

I'm having trouble removing some duplication I've introduced in a rails plugin. The code below modifies the find and calculate methods of ActiveRecord in the same way, but I've been unable to remove the duplication. The find and calculate methods below make use of the super keyword which is one hurdle as the super keyword can only be u...

Best way/practice to ensure links are going to proper location when not on root of domain?

I've been wondering this for a while now, but what is the best way to ensure that in a web app (RoR, Sinatra, PHP, anything) that when you are creating links (either generating with a method, or writing in by hand) that they go to the proper place whether you are on the root of a domain or not: http://www.example.com/ or http://www.examp...

How can mod_perl and Passenger run on the same Apache server?

Is this even possible? I have a Rails app running on Passenger and a mod_perl site that need to run on the same server. I've tried setting up two VirtualHosts and I've tried just using one VH and an Alias/Location for the mod_perl. In both cases, Passenger tries to serve the mod_perl app and tells me it can't find the correct files. ...

Dependency on fixture data in rails initializer

I have an initializer which sets a default that is used throughout the app. The value is an ActiveRecord model, I'm essentially caching it for the lifetime of the app: @@default_region = Region.find_by_uri("whistler") The record is guaranteed to be in the database: it's fixture data which is referenced by other models. This works fine...

How can I fix this warning produced when I run my Test::Unit tests

I'm getting this warning in my Test::Unit output... /usr/local/bin/ruby -I.:lib:test -rtest/unit -e "%w[test/functional/sessions_controller_test.rb].each { |f| require f }" | unit_diff -u Loaded suite -e Started .../Users/ethan/project/mtc/contactdb/app/views/sessions/new.html.haml:30: warning: multiple values for a block parameter (0 f...

LigHTTPD + RoR: "spawning fcgi failed"

I'm trying to set up Ruby on Rails on lighttpd. The operating system is CentOS, though it may be notable that this is a Xen-based VPS. The problem occurs something like this: bash-3.2# /etc/rc.d/init.d/lighttpd start Starting lighttpd: [ OK ] bash-3.2# /etc/rc.d/init.d/lighttpd status lighttpd ...

Do I need to manually create a migration for a HABTM join table?

Hello. I'm struggling now to get HATBM working correctly. I have a beaten scanario: articles and tags. I presume, HABTM should be used here, since it is a many-to-many relationship. I don't know however if I should manually create a join table (articles_tags in this case). My code currently as follows: class Article < ActiveRecord::Ba...

Looking for a page designer

Hi all, My site currently has some static pages. I'm looking for a rails wysiwyg webtool with which I can change those static pages (with images) dynamically. The number of pages is fixed and I don't have to be able to dynamically add new. Update The site already has a design template assigned which I don't need to change. I only need ...

Testing helper methods in Rails

I'm testing my rails helper methods like this: require File.dirname(__FILE__) + '/../../test_helper' require 'action_view/test_case' require 'action_view/helpers' class ListingsHelperTest < ActionView::TestCase def setup @controller = ListingsController.new @request = ActionController::TestRequest.new @response = Action...

Why don't my views update?

I'm new to Ruby on Rails and am creating a test application. So far, it's working, but when I make some minor changes to my views, the page doesn't change. My problem may be related to this question, but I'm not sure what is meant by setting the date and time in the VM. My code is on a remotely hosted server, so I assume it would use th...

Best way to get will_paginate working with Ajax.

If you google "will_paginate" and "ajax", the top result is this blog post: But the original author of will_paginate says to not use this method (bad for SEO/spiders) ... But I cant get the original authors method to work (his javascript kills all my links). An other gentleman suggests a similar method to mislav's (the original will_pa...

Best Practices for a Web App Staging Server (on a budget)

I'd like to set up a staging server for a Rails app. I use git & github, Cap, and have a VPS with Apache/Passenger. I'm curious as to the best practices for a staging setup, as far as both the configuration of the staging server as well as the processes for interacting with it. I do know it should be as identical to the production server...

Where is the best place to store application parameters : database, file, code...?

I am developing a Ruby on Rails website and I have an "architectural" question : my application needs some parameters and I'm wondering where to store them. In concrete terms, my application receive some requests which are evaluated and then sent. So, the Request model must have attributes concerning these treatments : a validation stat...

Ruby On Rails is slow... ?

I'm writing a web application to monitor a furniture factory production flow. It has thousand of data to handle. So far, I run RoR on Mongrel + MySQL and it's really really slow (2-4min for some views). When I look at RoR logs, it seems that database queries aren't slow (0-10ms). Is RoR slow when it converts database data to object ? Is...

How can I force gem to upgrade to gem 1.3.1

I am trying to install a gem like this: C:\InstantRails\rails_apps\foodmarksthespot>ruby script/plugin install git://github.com/lazyatom/engines.git Which returns this message: Rails requires RubyGems >= 1.3.1 (you have 1.2.0). Please `gem update --system` and try again. But when I try to update using: gem update --system it say...

Shoulda: Testing contoller filters

So I have decided to investigate the state of Rails' testing. After reading a few accepted answers here on SO talking about how Rails' testing documentation is atrocious I am starting to agree. Thus far, I am apparently not in the club of people that understand Rails testing- even though I understand the framework quite well, or so I tho...

Rails wiki-style editing - textile or markdown?

I'm looking to give our users some wiki-style editing capabilities (much like I'm using now) on our Rails web application. Does anyone have any opinions on whether I should use Markdown/BlueCloth or Textile/RedCloth (or something else entirely)? Also, related to this question, is BlueCloth secure from a XSS perspective? Thanks. ...

OCIError (ruby on rails)

I am using rails freeze 1.2.3 to run a rails app. Because the app is on a remote machine, I used ssh tunnel (ssh -l -L) to show the app on my screen. When I ran it, it correctly prompted the login page, after I put in the info, I got this error: OCIError in ServiceController Error while trying to retrieve text for error ORA-12154 I have...