ruby-on-rails

calling wcf /web service from php/ruby

For my sins, I am in charge of developing a service for providing data to both our internal systems running .net apps as well as external systems running php. For the sake of future proofing, I want to ensure it is callable from ruby as well. My service will perform authentication and look up account details from a central user reposit...

Ruby Custom Class to Model

I'm sure this is a completely obvious beginner question, but trying to find answers to beginner Ruby questions on google is turning out to be an exercise in futility. Anyway, suppose I have a database table that looks like this: MyMessage ================== int :id string :from string :to string :messagetext Now, if I need to expose ...

Testing strategies for Ruby on Rails & Twitter OAuth

I am developing an application that utilizes twitter oauth and ran into a brick wall trying to figure out how to test twitter oauth. Particularly trying to use Cucumber and Webrat/Selenium to do test the functionality -- Certain steps in the registration/logon process behave differently if the user has given oauth access to the app or no...

ActiveRecord Models - adding custom methods

Hi, I have 10 models and 3 of them need some additional custom methods which happen to be: has_staged_version? apply_staged_version discard_staged_version I want to define these methods once. I could create a custom subclass of ActiveRecord:Base, define the methods there, and have my 3 models inherit from it. But is there a more "Ru...

how do i set up a load balanced Rails web server using mongrel, lighttpd and iis on windows 2003

I understand that this is not the perfect environment for doing this but please stick with me and help if you can... The set up I want to achieve is to have my rails application running on a windows 2003 server, using a pack of mongrels with lighttpd acting as the load balancer and IIS in front of it all passing client requests to light...

Rails Exception notifier is not working

I installed the exception notification plugin from http://github.com/rails/exception_notification/tree/master I can confirm that my ActionMailer is working as I received emails from other process. Although, I can see the notifier sending the email in the log (Sent mail to [email protected] ) and the email address was written correct, I d...

How to deploy a Rails app to Dreamhost?

I'm kind of lost, I try to deploy my application on a shared dreamhost server. Now everything works fine locally. It's my first try at Rails, and I'm not really a programmer or sysadmin, just hacking something together. On Dreamhost, if I start webrick, it works fine on port 3000, but webricks gets killed pretty quickly, I guess that ma...

Adding rspec test for library module doesn't seem to pickup Expectations and Matchers

I'm adding more rspec testing to my app and would like to test a ScoringMethods module, which is in /lib/scoring_methods.rb. So I added a /spec/lib directory and added scoring_methods_spec.rb there. I required spec_helper and set up the describe block as so: require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') descri...

Many-to-Many Relationship With Same Table (Ruby on Rails)

I'm working on a Rails app that has a "products" model. I want to be able to relate products to each other. Example: product 1 related to product 2, product 3, and vice versa. How would I accomplish this in Rails? I was thinking a join table, but since I'm using the same table as the point-of-relationship I'm not sure how that would work...

Sortable list without a database

I have a virtual shopping cart using sessions (sessions stored in the DB). I add products to the cart using an AJAX call. This list is also sortable. The problem I am having is updating the sort position of the products in the cart, given that the shopping cart is virtual. Can anyone help (specifically with the sortable_element :update ...

How: Ruby on Rails to build a basic site

I'm a compsci student who wants to get learn a little about web development -- I learn best by doing. I know basic html/css/php/javascript/xml, but since Ruby is one of my favourite scripting languages, I figured I'd learn Ruby on Rails. I'd like to build a basic website for a friend's club at school that just provides information abou...

Changing the active_resource_store database for sessions in rails 2.3.2

There's a great answer for my question over here http://stackoverflow.com/questions/378376/rails-shared-sessions-with-activerecord but it has to do with rails 2.2.2. The method used has been deprecated in 2.3.2. Does anyone know how to use an external database for session data in rails 2.3.2? The overall goal is session sharing betwee...

How to use jQuery Form Plugin with Rails js.erb template?

I am using the jQuery Form Plugin with my Rails app. I have a form like this: <form action="/comments" id="comment_form" method="post"> <textarea cols="60" id="comment_comment" name="comment[comment]" rows="3"></textarea> <input id="comment_submit" name="commit" type="submit" value="Add comment" /> </form> My application.js file h...

Rails: post data with a '+' is getting set to a blank

I have post data that includes a '+' sign. Once it makes it to the server the raw post data is showing the '+' sign but once the post data makes it into the param hash the '+' sign has been converted to a blank. Any ideas on how to make it NOT do that? ...

ruby script/plugin discover RuntimeError

Having problems when running this command on a rails installation on windows under a corporate firewall: ruby script/plugin discover I already set up the http_proxy variable on the system and this is the error I get: C:/Ruby/lib/ruby/1.8/open-uri.rb:203:in `open_http': Non-HTTP proxy URI: http-proxy(RuntimeError) from C:/...

Mephisto x autocomplete

Hi, I'm trying to use the plugin auto_complete with mephisto. My problem is that i cannot add a code to a view because i don't have a liquid tag to do it. I read a liquid manual that teaches you how to create your methods inside of a new liquid tag, but how can i create a new liquid tag to a plugin method? ...

Cucumber: Access current controller instance within step definitions

I'd like to access the controller instance in my cucumber step definitions. The purpose of this is so I can manipulate http cookie and session values. I'm pretty sure there's a way to do this via World, but I'm not sure how. In regards to Ryan's comment, I'm writing a feature for a page which requires a logged in user (via Authlogic)....

What type of Rails model relationship would work best for aggregate keys + multiple foreign keys?

I'm considering the following database structure but I'm not sure what type of Rails model relationships would support the database keys I have defined. Could anyone suggest how this might work in Rails? Posts id post_type -- must be 'Q' or 'A' author date content UNIQUE KEY (post_id, post_type) -- to support foreign keys Questions id ...

Rails flash is throwing wrong number of arguments (0 for 2) error

I just upgraded an app from rails 1.2.3 to rails 2.0.2 (I tried 2.3.2 first and failed). I had to make a few plugin tweaks, but overall went smoothly. That is, until I realized my flashes weren't working. So I then downgraded back to 1.2.3, and still receive the following error: ActionView::TemplateError (wrong number of arguments (0...

Is there too much Magic with Rails for a beginner?

Let me start by saying I know that both Ruby and Php are great languages and this is not intended to start a flame war. My question involves learning web development fundamentals and I have heard that Ruby on Rails can allow too much to be done in the background via Magic. I have so far done some learning in both Php and Ruby and while...