ruby-on-rails

Necessary to set ServerSignature and ServerTokens apache config options with Rails apps?

I came across something in one of my rails books that said I should set ServerSignature Off ServerTokens Prod to disable apache from showing server information in production when the app screws up. Is this necessary? The only error message I see in prod is the standard Rails production error message. I never see any server informat...

What's the restful way to implement a forgotten password feature?

I have the following restful structure: My login page uses the session/new action My signup page the users/new action My logout page uses the session/destroy action My register process uses the users/create action I need 3 more actions for: I forgot my password page Start forgotten password action (send email) Reset passwor...

Shopping cart implementation

I want to integrate a shopping cart in my site. The cart should be such that it resets once the user signs out of the application. This can be either achieved via sessions or using the database tables. What should be prefered out of the above two? Are there any security loop holes if this is handled via sessions? ...

Is there a way to force a before_filter to always execute last?

I'd like to define a before_filter in a controller, but always have it execute last. I know about append_before_filter, but I'd like to specify this filter in a module, where other classes may also later add other before_filters. Is there any way to do this? ...

Problem sending multipart mail using ActionMailer

Hello, I'm using the following code to send emails in rails: class InvoiceMailer < ActionMailer::Base def invoice(invoice) from CONFIG[:email] recipients invoice.email subject "Bevestiging Inschrijving #{invoice.course.name}" content_type "multipart/alternative" part "text/html" do |p| p...

Automatic wiki links in Rails

I'm trying to build a simple wiki system in Rails. What i would like to do is to turn words within double brackets into links, automatically. E.g. if i have a word written like this [[example]] Rails automatically generates a link like: /notes/show/example Any ideas of how i could do this? Many thanks ...

Which is a better choice for me Ruby on Rails or J2EE?

I have a large set of classic ASP pages to convert. I will be running a Mac OS X server 1.5.7. I can choose anything I want, within reason, but I am stuck between Ruby on Rails or the full J2EE stack and an ORM. My main concern is the databases I have to hit and what each framework/stack is made to do. I became concerned after actual...

Is Spring hard compared to Ruby on Rails?

If I have no to little experience in either of them, but know enough Java and Ruby to be comfortable, is one framework harder to learn than the other? Is one easier to use for the beginner on these? I know it is hard to answer. Just looking for general thoughts on it. ...

How do you query a database in the middle of a jruby on rails webpage?

Not sure how to ask it so sorry if I mess up my terminology. In using jruby on rails, how would I query two (or more database) to serve back to the view page? I have seen where I set up my database connection in database.yml and it works fine but I am now wondering how I move beyond this to hitting many databases with jdbc and puttting...

How do I validate a virtual attribute in an ActiveRecord model?

I am using virtual attributes to save tags in an Entry model from a comma-separated textbox in my form (based on Railscasts #167): class Entry < ActiveRecord::Base has_many :entry_tags has_many :tags, :through => :entry_tags after_save :update_tags attr_writer :tag_names def tag_names tags.map(&:name).join(", ") end ...

Rails: Resources_Controller/ Resource_Controller/ Make_Resourceful with Subdomain_Fu

I need to use one of the resourceful controllers plugins - resources_controller/ resource_controller/make_resourceful as I have several polymorphic models and the models have to be either initialized/build depending on the route. For example: www.example.com/groups/1/pages www.example.com/projects/1/pages where page acts as polymorp...

Database and relationship design when subclassing a model.

I have a model "Task" which will HABTM many "TaskTargets". When it comes to TaskTargets however, I'm writing the base TaskTarget class which is abstract (as much as can be in Rails). TaskTarget will be subclassed by various different conceptualizations of anything that can be the target of a task. So say, software subsystem, customer ...

illegal character, Javascript

I am trying to run jquery through a rails app. I have the edit information in a popup window and i want to change that to show information after they click update. It should work but this line $(".edit_business).append("<%= escape_javascript(render(:file => 'businesses/show')) %>"); is throwing an illegal character issue. This code i...

Passing multiple form values with observe_field? (JQuery equivalent to Form.Element.serialize)

I have a form with two text_fields: <input type="text" id="post_name" name="post[name]" /> <input type="text" id="post_email" name="post[email]" /> And I have an observe_field on the name input box but I also want to pass the email value with it. In prototype this is done via: <%= observe_field :post_name, :url => { :controller => :...

For Rails apps, keeping your environment.rb file in your repository seems unsecure...

Many Rails apps use the CookieStore method of storing sessions. The security of this method depends mainly on the security of the session secret key which is defined by default in config/environment.rb: config.action_controller.session = { :session_key => '_some_name_session', :secret => 'long secret key' } Most people i...

RoR, Jquery, Ajax form errors

Alright. I have a create form where people are able to create businesses which are then added to the database. Everything worked fine. Rails was throwing it's errors if things weren't filled out correctly and if they were, you;d be directed to another page that would show you the business you just created. Now with that, I have to be ab...

Ruby / Rails garbage collection

Since http is stateless, every request to an app creates a new object. How does Rails clean up the unused objects / how frequently? ...

What RoR programs are used in this tutorial

I'm new to rails, and I'm watching this video tutorial online and I was wondering what programs are being using - I recognize terminal, but thats about it. http://media.rubyonrails.org/video/rails_take2_with_sound.mov ...

Validate no routing overlap when creating new resources in Ruby on Rails

I've got a RESTful setup for the routes in a Rails app using text permalinks as the ID for resources. In addition, there are a few special named routes as well which overlap with the named resource e.g.: # bunch of special URLs for one off views to be exposed, not RESTful map.connect '/products/specials', :controller => 'products', :ac...

(Rails) Protecting code and licensing for independently deployed Rails applications...?

Hi All, I'm writing a Rails application which will have reasonably regular updates -- nothing abnormal here. I face a problem, however, due to the distribution model. Basically the application will be sold for stand-alone "intranet" installation due to its "add-on" nature (it's basically a web interface for an existing, database-drive...