ruby-on-rails

Access resources login protected with Rails and Flex

Hi, i'm trying to figure out how i can handle login protected actions in RoR (Ruby on Rails) with Flex without using weborm or rubyamf remoteobject. I'm in the situation where i have to fill a datagrid with results of an HTTPService request after i log in correctly into my application. Can anyone suggest me the way to accomplish that? ...

Multiple User Logins in Rails

I am working on an app right now where I have Individuals, Athletes and Coaches. A coach has many athletes and they create athletes as well. Whereas individuals can just come to the site and use a different set of tools. So for functionality and logic reasons I prefer to keep the individual model separate from the athlete model. When u...

Access plugin helper methods and lib on rails

I am currently delevoping a community using Community Engine, but I need to add some models. The problem is that I need the helpers methods that are used by CE, but when I try to access the new sections of the site, I get a undefined method (like below) undefined method `logged_in?' for #<ActionView::Base:0x1048f3748> The logged_in? ...

Using Jquery Jcarousel, I need help modifying the pagination

First as a note I am using this plugin in a Rails app. Ok I need to do two things. The first is that the pagination that I have working through: jQuery('.jcarousel-control a').bind('click', function() { carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text())); return false; }); needs to work without text. right now...

TextMate brackets insertion

Please note that I did ask this on Super User and received absolutely no responses, so I decided to port this to a programming community that knows a lot more about TextMate. Working in Ruby on Rails in TextMate, when I select a chunk of text, let's say My text and then hit the open bracket [ key on my keyboard, TextMate wraps the ...

Using controls requiring different jQuery Versions

I am trying to use an Apycom menu requiring jQuery 1.3.2 on the same pages as Flexigrid for Rails which depends on jQuery 1.2.3. To add to the confusion I'm trying to include the Rails 'prototype.js' and use this as well. Here is my include order: <%= javascript_include_tag :defaults %> <%= yield(:head) %> <script src="/javascripts/jq...

RESTful API Suggestions

I'm about to create an API for a existing .NET application and want to go the RESTful service route. Our backend platform is .NET and MSSQL. I'm hoping for a good blend or scalability combined with clean architecture. Are there any strong opinions on the best way to implement a RESTful .NET API (WCF, standard ASP.NET, MVC or even HTTP ...

Rails Validations, only integers for :price_in_cents

validates_format_of :price_in_cents, :with => What is the regexp for this simple validation ...

Rails3, and users credentials : which plugin ?

Hi, I'm starting a new project on Rails3 and my question is about which plugin can i use to manage my users. I heard about Authlogic but it seems to don't be compatible with rails3. So if you have any suggestions, I'll be glad to hear them. Thanks ...

LDAP and Ruby on Rails

I'm trying to connect to an existing LDAP server to authenticate users trying to use my app – I'm having trouble figuring out where to start. I've read about LDAP, understand how it works, and have looks at libs like ActiveLdap. I'm just not sure where to start from here: I have the hostname of the server I was to authenticate agains...

How to access request headers only in a rails 2 application?

Rails provides a request.headers method that returns both all headers and a lot of extra non-header information... i would like to access only the request headers, how can I do so? Regards ...

Return embedded documents in query

Is it possible to perform a query and return the embedded documents? Currently, I have: class Post include MongoMapper::Document many :comments end class Comment include MongoMapper::EmbeddedDocument belongs_to :post key :author key :date key :body end Here is a query that is almost there: Post.all("comments.date" ...

Using devise with Rails 3 beta

I'm currently trying to use Devise 1.1.pre3 as authentication in my upcoming project, but I can't get it to work properly. I have done everything it says in the documentation, installed warden and the correct Devise version, run the install and used the generator to create the model. But when I try to access the sign up form (localhost:...

How do I link several elements of different types to one another in RoR?

I have Events, Documents, and Surveys which all need to be able to link to one another, I was planning on having a linking table with four columns as follows: link_elements{ element1_type CHAR(1) element1_id INTEGER element2_type CHAR(1) element2_id INTEGER } The problem is I can't figure out how to make the model in RoR so th...

Rails route for mapping records by name rather than id?

In my Rails application, I would like to route /product/productname1, /product/productname2, etc. to ProductController::index(). I don't want separate methods in my ProductController for each product name route. What would my route look like? I have map.connect 'products/:name', :controller => 'products', :action => 'index' But when...

BDD and API calls you don't want to make during tests

I am working on a Rails app that allows you to create a configuration and then launch a server at EC2 with this configuration. So far I've been using cucumber for BDD and was very happy with that. However, now I want to pick a configuration and actually launch the server. Due to cost and performance issues I don't want to actually launch...

Ruby on Rails ActiveRecord: table with foreign keys in more than one other table

I'm new to Ruby on Rails and I'm trying to model my table relationships. To simplify the problem, let's say I have 3 tables: -- Customer (id, address_id, ...) -- Employee (id, address_id, ...) -- Address (id, ...) Would the Address model have the following? has_one :customer has_one :employee I know this is true in the case of a sin...

Rails Validations, number + letters + spaces

Looking for a Rails validation that will only allow letters, numbers, and spaces. This will do letters and numbers, but no spaces. I need spaces. validates_format_of :name, :with => /^\w+$/i, :message => "can only contain letters and numbers." ...

Finding last active time for logged in user

I am using ruby on rails session to store a user cookie to keep them logged in, so I can't just update a last_seen column after they login. I'm trying to figure out the best way to find out if a user has been active in the last day. This is what I have so far but I'm wondering if there's a better way: class ApplicationController bef...

Continue after exception in RSpec

Is there any way to have RSpec continue processing specifications after an exception is raised? This is what my spec task looks like: SPEC_PATTERN = "spec/**/*_spec.rb" Spec::Rake::SpecTask.new() do |t| t.spec_files = FileList[SPEC_PATTERN] t.verbose = true t.spec_opts = ["--format", "html:spec/spec_report.html"] t.fail_on_erro...