ruby-on-rails

Rails not refreshing code

While developing a Rails app, I usually leave the dev server running locally (mongrel) as I work on the code. Changes in the code take affect after a quick refresh. EXCEPT changes havent been taking effect for a class I've been writing in the Lib in folder. Is this in any way a known problem? What could be causing this? It is very frustr...

Rails hover popup using dom popup kit - Need help making div with popup content dynamic

I'm using the DOM Popup Kit to create Netflix like popup windows when a user hovers over an image. The kit requires me to place the popup content in a div at time of page loading. The page I'm using this functionality has about 100 images, thus having to create the div content for all 100 images is slow. Thus I would like to update th...

`load_missing_constant' after installing Typus rails plugin

Getting an odd error. Just installed the Typus rails admin plugin, which is supposed to work in 2.3.2. However, after install it seems to mess with my user model. Not sure where to start here, any ideas? => Booting Mongrel => Rails 2.3.2 application starting on http://0.0.0.0:3000 /Users/apple/.gem/ruby/1.8/gems/activesuppo...

Local copy of Rails in a rails application

I recently upgraded a rails project I am working on from 2.0.5 to 2.3.2. I noticed that there was a local copy of the 2.0.5 rails files in vendor/rails and I was wondering should I put a local copy the 2.3.2 rails files in there too or just leave them out? What is considered a better practice? ...

custom properties in Rails

Hi, I have just started Rails and have a basic question. I need to add customer properties(like email id etc) so that the Rails app can read them at runtime. How can I do this ? Can I add them to development.rb and if so how can I read it ? In java I would have created a properties file and read it from my app. thank you, firemonk...

How to efficiently handle the changes between production and development when updating from the repository

I have inherited a project with a local development environment that has code specific to that machine, and which is different for the production server. Even though the majority of it is contained in constants and the rest is in the tests, every time I commit from development and update in production I'm going to have to make the same ...

nested forms (design question)

Hi, I have a list of items displayed on my page. Item A [Edit] Item B [Edit] Item C [Edit] Each item is editable When you click on a edit icon. The edit form is displayed with a ajax call and the controller return a form. Edit form for Item A [Save] Item B [Edit] Item C [Edit] But all the list is bulk editable and so each item h...

Writing an encrypted cookie session store for Rails; is my approach secure?

By default, Ruby on Rails stores session data in cookies. This has many advantages, such as the lack of need to setup any persistence layers on the server side. However, the session data is not encrypted, and the Rails app that I'm writing puts potentially sensitive data in the session. I'd like to avoid storing session data server-side ...

How is Capistrano related to Rake?

I'm starting to read up on Capistrano after using Rake tasks to deploy apps for a long time. It's really striking how similar it is to Rake. A lot of parallel commands (like cap -T) and a lot of identical concepts (namespaces, tasks). Does anyone know the history behind that? Is Capistrano an extension of Rake, or built on top of it? ...

What's wrong with using a framework that has a lot of dependencies?

Hi, all. I recently told a friend that I was starting to learn Catalyst (Perl) and he fairly strongly emphasized that because Catalyst has so freakin' many dependencies, I should use something like Rails instead. Isn't that a good thing that there are a lot of dependencies? Doesn't that indicate a lot of code re-use? I understand tha...

Indexing calculated field for search conditions in Thinking Sphinx

I have a products model set up that I am trying to search with Thinking Sphinx. The model has an attribute called status which can be Active, Not active or Active during specified dates. I would like to be able to restrict my search results to products that are active. I.e. has status of active or has status of active during dates and ...

How to do static content in Rails?

Looking at different options: One is to just put the static pages in the public/ folder, but I do want the header from layout/application to be consistent. I tried this, but I got an error: in routes.rb: map.connect '*path', :controller => 'content', :action => 'show' in content_controller.rb: def show render :action => params[:pat...

Rubys on Rails project Using Aptana

Hello, I am having a major issue with creating a Rails Project on Aptana (using mac os x). Basically, when i try starting a Rails project and name a file, it comes back with an error saying: "!!! Path to log file not valid: /Users/fab/Documents/Aptana Studio Workspace/test.rb/log/mongrel.log mongrel::start reported an error. Use mong...

Generating a unique file path with Polymorphic Paperclip

I'm running into an issue with different users uploading files with the same name being overwritten with the Polymorphic Paperclip plugin. What I'd like to do is inject the current user's ID into the URL/path. Is this possible? Would I be better off generating a random name? Here are my current :url and :path parameter values in asset.r...

Ruby On Rails and "external classes"

I have RSS-reader class for Ruby, and I'd want to use it in rails, where does the rss_reader.rb go? To "libs/rss_reader.rb"? I tried that, then requiring it in controller, but I get error: 'MissingSourceFile (no such file to load -- lib/RssReader)' ...

How do you append a filter to the very end of a filter chain from a superclass?

Hi there, in rails when you register filters in abstract superclasses they come before the filters registered in the controller class. Say I wanted to execute a method called authenticate as a filter right at the end of the filter chain. The only way I can figure it out is to declare that before_filter as the last filter in all my contro...

Ideas for UI design for editing organizational hierarchies

I am working on an Rails app which has an admin section for setting up organisations. The hierarchy of which is: Organisation Area Office Division Department I have used ActiveScaffold to knock together something really quick, but it makes for a pretty horrid UI. To edit/add a department, I have find the organisation in the tab...

Methodology for a Rails app

Hi there, I'm undertaking a rather large conversion from a legacy database-driven Windows app to a Rails app. Because of the large number of forms and database tables involved, I want to make sure I've got the right methodology before getting too far. My chief concern is minimizing the amount of code I have to write. There are many mode...

Extension/plugin/module system for a Ruby on Rails application?

What would be the best approach to develop an "extension" system for a Rails application? I mean the same kind of system that WordPress has, like registering functions to hooks, etc. Then plugins could be activated/deactivated from an admin panel. Are there some books/online material about implementing this kind of functionality in RoR...

Newbie question attribute from associated table not showing up in index view

Hi I know this is something simple I am doing wrong. I have three tables, installation, neighborhood, schools Installation: has_many :schools has_many :neighborhoods Neighborhood: has_many :installations has_many :schools Schools: belongs_to :installations belongs_to :neighborhoods I can't figure out how to show the name...