ruby-on-rails

How do (or can I) hack a gem temporarily while looking for a bug?

I have a gem installed in my home directory on a laptop (eg not THE server). I have installed ruby 1.9.1 and also some other gems, notably right_aws - which allows access to s3, etc with ruby. All works, except there is a bug when I do a query on SimpleDB, and the returned list of items includes an item with any two byte utf-8 characte...

Sending a signup confirmation email with having to confirm using Devise

Hi all, I'm using devise to handle user authentication with my rails app. I'd like to allow my users to sign up and be instantly logged in and receive a confirmation email. Devise has the Confirmable module which sends out an email but requires the user to open up their mail application, find the email and click a link which then leads...

Port a Rails App from Windows to Mac or Linux

Hello I've been a Rails developer on Windows for quite some time now, but I recently completed my biggest project yet (it's quite extensive, took me over a year to build) but I am having trouble deploying it. The combination of it's size, complexity and a windows environment is making it needlessly complex to deploy. I am thinking about...

rails named_scope ignores eager loading

Two models (Rails 2.3.8): User; username & disabled properties; User has_one :profile Profile; full_name & hidden properties I am trying to create a named_scope that eliminate the disabled=1 and hidden=1 User-Profiles. The User model is usually used in conjunction with the Profile model, so I attempt to eager-load the Profile model...

Rails - Accessing Model Attributes in Forms

Hi, How do I access a model's parent's attribute in a form? For example, for the following form for answer, I want to access answer.question.text and use that for the question - how do I do this? Thanks! <% form_for :answers do |ans| %> <%= ans.label :question, "Question" %> <%= ans.text_field :value %> ...

Rails advanced queries with join and sum calculation

I have two models: companies and expenses. Companies have many expenses and expenses belong to companies. My expense model has an 'amount' column. I was wondering if there is a way to perform a find based on a date range and the amount column of the expenses. Something like top 3 companies by total expense amounts over a 7 day period. ...

Storing information inside YAML

I looked through the YAML for ruby documentation and couldn't find an answer. I have a list of several employees. Each has a name, phone, and email as such: Employees: Name | Phone | Email john 111 [email protected] joe 123 [email protected] joan 321 [email protected] How would I write the above information in YAML to end up wit...

how can i generate a diagram from a rails project ?

i am trying to generate a rails diagram from a project with railroad. but i am getting a railroad: command not found even after installing the plugin : sudo gem install roadrail what is the problem? is there an alternative to that plugin? thank you for you help ...

Why is Ruby on Rails lacking on documentation?

Configuring the PHP debuggers was so hard that I can't even imagine myself using the Rails documentation by blogging. The problem looks easy to solve: write the documentation, so why doesn't anyone do it? I'm thinking that if you don't have a way to learn it, you have to ask the ones who know it, so who can know it and why? ...

Adding confirmable module to an existing site using Devise

Hi all, I'm using devise for a web app and wanted to add the confirmable module to the site. However, since a confirmation_token isn't generated users can't sign in. When clicking the 'Didn't receive confirmation instructions?' link the token still isn't generated. Confirmation email just generates this link (notice the lack of token i...

ActiveRecord Create (not !) Throwing Exception on Validation

So I'm using ActiveRecord model validations to validate a form in a RESTful application. I have a create action that does: @association = Association.new and the receiving end of the form creates a data hash of attributes from the form parameters to save to the database using: @association = user.associations.create(data) I want...

Can I have/use different Versions of rails in the same machine

I am actually reading a rails book that is written for rails 2.3.5. I want to test Rails 3 beta as well. Is it possible to have such a setup in my Mac OS leopard? I have tried with gem list -d rails. There are many versions stored in my mac but I don't know how to use different versions of rails while creating applications using rails c...

Cucumber could not find table; but it's there. What is going on?

I'm working with cucumber and I'm running into difficulties. When I run "cucumber features", I am met with errors, cucumber is unable to find my requests table. What obvious mistake am I making? Thank you in advance! Bash: justin-zollarss-mac-pro:conversion justinz$ cucumber features Using the default profile... /Users/justinz/.gem/r...

Rich-Text-Editing Rails-Based CMS

I am searching for a rails-based CMS that provide rich text editing feature (i.e., I need an interface very similar to that of Wordpress where you can easily style up your static pages and upload pictures without knowing any css or html) AND easy to be dropped into an existing rails application. Camtose, RadiantCMS and few other ones di...

Interpolation not working on Rails generator

For some reason the code I have included below does not interpolate the variables into the template. It simply copies the file over verbatim. I cannot figure out why. https://gist.github.com/60484f7b57b06b6eb3e3 The Rails version is 2.3.4. Thanks in advance! ...

Ruby environment messed up, How to uninstall ruby-gems-rails from Leopard ?

Hi, my ruby environment in my mac Leopard is all messed up. And I want to uninstall the entire ruby, gem stack and install them again from scratch. How can I do it ?please point me towards a good resource on the net. thanks ...

Auto update CSS from SASS/SCSS in Rails?

Maybe I'm confused on how SASS/SCSS works within Rails (2.3.8.) but I was under the impression that if I included the option Sass::Plugin.options[:always_update] = true that whenever I changed my SCSS file and then hit the page (controller) again, the SCSS would recompile. I can't seem to get this to work, and can't seem to find a go...

Updating extra attributes in a has_many, :through relationship using Rails

I've managed to set up a many-to-many relationship between the following models Characters Skills PlayerSkills PlayerSkills, right now, has an attribute that Skills don't normally have: a level. The models look something like this (edited for conciseness): class PlayerSkill < ActiveRecord::Base belongs_to :character belongs_to ...

Rails Nested Attributes, Relationship for Shared or Common Object

This has to be a common problem, so I'm surprised that Google didn't turn up more answers. I'm working on a rails app that has several different kinds of entities, those entities by need a relation to a different entity. For example: Address: a Model that stores the details of a street address (this is my shared entity) PersonContac...

"getaddrinfo: Temporary failure in name resolution" in RoR application

Hey I'm trying to retrieve emails from gmail using pop3 to my rails applicaiton. I get the error - "getaddrinfo: Temporary failure in name resolution" when i try to retrieve the email. the weird thing is, it works when i try it at home but not at my university. i'm guessing it has something to do with the internet connection. please ...