ruby-on-rails

How to install Ruby on Rails alongside WampServer ?

Is is possible to install Ruby on Rails alongside WampServer (and keep WampServer's Apache/MySQL installs)? ...

form_remote_tag won't execute :method => :put

Can someone tell me why this is executing the POST method instead of my PUT method that I specify on the ajax request. <% form_remote_tag( :url => contact_url(detail), :method => :put, :complete => "Element.toggle($('#{form_id}))", :success => visual_effect(:shake, "contact-#{detail.id}"), :update => "contact-#{detai...

Difference between 'self.method_name' and 'class << self' in Ruby

I was trying to limit the instantiation of a class to just a single one(without using singleton) but i couldn't. I tried with class variables (@@) but without luck. I googled it and came across this: class A @count = 0 class << self attr_accessor :count end def initialize val @a = val self.class.count += 1 ...

How secure are Authlogic passwords?

I'm planning to make the database of a Rails project available for download publicly. This database contains an Authlogic users table, with crypted_password and password_salt fields. How securely are these passwords stored... is it safe to make them available publicly this way? Or should I look at implementing another authentication syst...

How to get memory usage in Rails app.?

For example, I have Update action in Product Controller. I want to measure how much memory consumption when the Update action being invoked. thanks. ...

Rails and Ajax - form_remote_tag Can't find my error.

Hello! On my site, the user can watch his profile. In his profile he can have a look at his data (i.e. signature). Now I want my users being able to edit this data while watching it. So I coded the following in my view: <div id="profile-signature"> <p> <b>Signature:</b> <%=h @user.signature %> </p> <%= form_remote_tag(:up...

Rails: using "content_for" after the corresponding "yield" inside layout

Hi everybody, I think this has been asked before but even though I searched Google I haven't come up with a solution. So this is what I'm trying to do in Rails 2.3.5: layouts/application.html.erb: <html> <head> ... some other stuff <%= yield :head %> </head> <body> <% content_for :head, "something that belongs in the...

I have a bunch of listings, I am trying to sort by featured and date in rails yet it's not working properly...

Let's say I have a listing a listing has a date and a featured (of true or false) How do I order my listings to order by featured = true first? Currently I have some listings as featured nil, then a few appeared as false - the ones that appeared as false are showing up before featured true. This makes sense because false is before tru...

Is it there a Ruby equivalent of Java's Wicket ?

The idea would be to replace ERB with templates that are pure XHTML and that the view would be pure code manipulating the template content. Have this been done already ? ...

when I run rails console in netbeans6.8(Ruby on Rails) then getting error ?

when I run rails console in netbeans6.8(Ruby on Rails) then getting following error ? 'irb.bat' is not recognized as an internal or external command, operable program or batch file. what I need to do for this ? ...

How can I pass to Ruby obj to Javascript?

I have this to calling the choose_category: <% form_remote_tag :url => { :action => :choose_category, :id => category } do %> <%= submit_tag category.name%> <% end %> And I have this method to calling the choose_category.js.rjs: def choose_category begin category = Category.find(params[:id]) rescue ...

Passenger with Prawn won't start

I have a app that uses Prawn to do some PDF generating, it works fine and I've had no problems with it. It's now come to the point where I want to test it through Apache using Passenger. This is where the problem appears. I get the passenger error page with this error: no such file to load -- prawn (MissingSourceFile) I restarted scri...

My site name and url are not recognized from my mailers.

Hi, I'm new at ruby on rails, and I've noticed that when I send an email, my site_name and site_url vars are not being recognized from the mailer files. In my config.yml file I've got the following: development: &local site_name: my site name site_url: http://localhost:8282 company_name: my company name admin_email: a...

Generate information based on content in RoR, any ideas on that?

I have many products, each product belong to one category. How can I generate each category in hyper text, and when I click on the category hyper text, I can get all the products which is belongs to this category. And ideas on that? ...

How to I change the button into hypertext in RoR

Here is the code for generate button, but I want it in a hyper text, how to modify this? <% form_remote_tag (:url => { :action => :choose_category, :id => category }) do %> <%= submit_tag category.name %> <% end %> I tried to use the link_to, but it can't submit a post method, what can I do? ...

Rails: Link to partials?

Hello! At the moment I try to do following: I created several partials (i.e. _show_signature.html.erb) for my user. Now I want to show them on clicking a link. In my user controller, I created a new action: def show_signature @is_on_show_signature = true end def show_information @is_on_show_information = true end ...

Warning: already initialized constant JAVASCRIPT_DEFAULT_SOURCES

I switched from prototype library to jquery with jrails plugin. After that I've got the warning: jrails.rb:17: warning: already initialized constant JAVASCRIPT_DEFAULT_SOURCES jrails.rb looks like: ActionView::Helpers::PrototypeHelper::JQUERY_VAR = 'jQuery' ActionView::Helpers::AssetTagHelper::JAVASCRIPT_DEFAULT_SOURCES = ['jquery.mi...

Ruby on Rails - has_many :through with nested_attributes_for

I'm coming across a problem that I can't find much online for via Google, forums, groups, etc. and so I'm going to raise my hand and ask for help from those who are more wise than I :) I have a rails project setup that was using nested_attributes_for with a one-to-one relationship between two models. It worked quite easily and as expec...

Testing rails application with a I18N database backend

I use Rails 2.3 i18n with a database backend plugin : http://github.com/dylanz/i18n_backend_database This stores my translations and locales in two DB tables. What would be the best way to get these tables working with my tests? I'm guessing I could write a rake task that would copy the tables from the development DB to the test DB. A...

Change value of request.remote_ip in Ruby on Rails

For test purposes I want to change the return value of request.remote_ip. While being on my development machine it returns always 127.0.0.1 as it should but I would like to give myself different fake IPs to test the correct behavior of my app without deploying it to an live server first! Thank you. ...