Questions tagged [ruby-on-rails-3]

Ruby on Rails is an open-source web development framework written in Ruby. Ruby on Rails follows the principle of convention over configuration, freeing you from having to re-invent things to stay productive. Use this tag only for Rails 3-specific questions, and also tag those questions [ruby-on-rails].

Ruby on Rails 3.0 was a major revision of Ruby on Rails in 2010, the open-source web development framework designed to make programmers happy and productive. Rails 3.0 brings a bunch of new features and improvements over older Rails versions, including:

  • Brand new router with an emphasis on RESTful declarations
  • New Active Record chainable query language built on top of relational algebra
  • Unobtrusive JavaScript helpers with drivers for Prototype, jQuery
  • Explicit dependency management with Bundler

See Ruby on Rails 3.0 Release Notes for more information.

Multiple sub-versions have been released, namely 3.0, 3.1 and 3.2. Questions regarding specific sub-versions of Ruby on Rails 3.0 can also be asked on the appropriate tags:

Resources:

See also:

56082 questions
18
votes
6 answers

Rails 3 jquery date picker date not saving to database

When I submit my form I can see the date being sent to in the post. However, It doesn't save the date. If I do a date check it says it is not in the proper format. Here is my date picker function, it displays fine: $j(function(){ …
Xaxum
  • 3,545
  • 9
  • 46
  • 66
18
votes
2 answers

link_to and remote => true + jquery : How? Help?

Im trying to make an "Users" link on the index of my rails website so that it shows the registered users (User.all) BUT i want that to appear on the right part of the website, as a partial, in a div without loading the whole page from the start. I…
Filippos
  • 221
  • 1
  • 3
  • 4
18
votes
1 answer

Showing the devise edit password screen

In my rails 3 app using devise, I want to provide a link for users to edit their password. I have a standard link that points to: /users/password/edit ... Log output below Started GET "/users/password/edit" for 127.0.0.1 at 2011-08-10 10:11:46…
AnApprentice
  • 108,152
  • 195
  • 629
  • 1,012
18
votes
1 answer

Rails 3 middleware modify request headers

My setup: Rails 3.0.9, Ruby 1.9.2 I am working on my first middleware app and it seems like all of the examples deal with modify the response. I need to examine and modify the request headers in particular, delete some offending headers that cause a…
Bob
  • 8,424
  • 17
  • 72
  • 110
18
votes
4 answers

rails where() sql query on array

I'll explain this as best as possible. I have a query on user posts: @selected_posts = Posts.where(:category => "Baseball") I would like to write the following statement. Here it is in pseudo terms: User.where(user has a post in…
stewart715
  • 5,557
  • 11
  • 47
  • 80
18
votes
3 answers

Good documentation for writing Redmine plugins

I am currently developing some plugins for Redmine, and I must say, I'm a bit disappointed with the lack of documentation available on this subject. Normally, If I am looking for explanations on classes/methods, I need to spend a consistent amount…
18
votes
3 answers

button_to without submit

Can I have a button in side the form, but do not have the type=submit? I am doing something special. I have a form, <%= form_for(@user) do |f| %> and this form will be rendered based on a value in a session. In side the form, I have f.submit…
jojo
  • 13,583
  • 35
  • 90
  • 123
18
votes
2 answers

Mongoid on RoR3: 1) how to return specific field on query? 2) what inverse_of is needed for?

Well, the title is self-explicative. But, let me elaborate a little better. First of all, I am using Mongoid, a Gem for using MongoDB with rails applications. #1) I have a large collection, which has information about a map. A map embeds a lot of…
FernandoH
  • 855
  • 1
  • 9
  • 17
18
votes
3 answers

Retrieving only certain columns with Rails 3 where clause

Not sure why I can't find out how to do this easily... Obviously I could do it with raw SQL, but I'm trying to familiarize myself with ActiveRecord. results = Model.where(:lat => (south..north), :lng => (east..west)) I don't want all the fields,…
Patm
  • 2,045
  • 4
  • 19
  • 22
18
votes
6 answers

Comparing a Date to the Datetime Created_at in rails3

So I'm trying to do things like so: today = Date.today - 1 todaysReport = Report.where(:created_at => today).find_by_user_id(user.id) The problem is created_at is a datetime, so it won't find any matches..Any suggestions?
Elliot
  • 13,580
  • 29
  • 82
  • 118
18
votes
8 answers

Decimals and commas when entering a number into a Ruby on Rails form

What's the best Ruby/Rails way to allow users to use decimals or commas when entering a number into a form? In other words, I would like the user be able to enter 2,000.99 and not get 2.00 in my database. Is there a best practice for this? Does gsub…
James
  • 181
  • 1
  • 1
  • 3
18
votes
3 answers

How to redirect page after confirmation in Devise

Say a user clicks a link to a page that is protected. They are then redirected to a sign in screen where they can log in. If they do, then are successfully redirected to that page. But if they don't have an account they have to sign up. This is…
RyanJM
  • 7,028
  • 8
  • 60
  • 90
18
votes
4 answers

rspec & devise test helpers

According to this from the devise wiki I should be able to use a login_user helper method in my controller tests. Accordingly I have the following within the spec directory: #spec_helper.rb ... Dir[Rails.root.join("spec/support/**/*.rb")].each {|f|…
mark
  • 10,316
  • 6
  • 37
  • 58
18
votes
6 answers

How do i get request.uri in model in Rails?

$request = request When I write this in controller, it will work. But if i need this variable in Model or Application controller, How can i ?
Sreeraj
  • 2,690
  • 6
  • 26
  • 37
18
votes
8 answers

How to set default rails version for a project?

I have installed two different rails versions in my system (Fedora). gem list -d rails *** LOCAL GEMS *** rails (3.0.5, 1.2.1) Author: David Heinemeier Hansson Rubyforge: http://rubyforge.org/projects/rails Homepage:…
Mr. Black
  • 11,692
  • 13
  • 60
  • 85
1 2 3
99
100