Questions tagged [ruby-on-rails-3.1]

Ruby on Rails version 3.1.0 is a specific version of Ruby on Rails. It was released on August 30th, 2011. Use this tag for issues related to development in Ruby on Rails version 3.1.

Ruby on Rails version 3.1.0 is a specific version of Ruby on Rails.

Released on August 30th, 2011, it was succeeded by version 3.2.0.

It brings many improvements to the Ruby on Rails web development framework, which is open-source and optimized for programmer happiness and maintaining sustainable productivity. Many things are defined by convention, freeing you from having to re-invent things to stay productive.

Version 3.1 brings many improvements over its preceding version 2, including faster ActiveRecord, assets re-structure, coffeescript, sass, and more.

Further Reading:

Related tag

5270 questions
48
votes
12 answers

Is it possible to test the order of elements via RSpec/Capybara?

I'm using RSpec/Capybara as my test suite. I have some javascript that dynamically appends
  • to the end of a
      . I want to write a request spec to ensure that this is happening. I tried using the has_css Capybara method and advanced CSS…
  • John
    • 9,254
    • 12
    • 54
    • 75
    48
    votes
    4 answers

    Adding New Admins to Active Admin

    I am using devise for my users. I recently installed the rails Active Admin gem, everything is working beautifully. However I can't figure out how to add a new admin users. I can see that active admin created an admin_user table in the db with a…
    alik
    • 3,820
    • 9
    • 41
    • 55
    46
    votes
    4 answers

    Uncompile Development Asset Pipeline

    I was compiling my asset pipeline for my production environment and it did for all my environments. How can I uncompile my asset pipeline for my development environment? I have checked my config/development environment and cannot find a fix. Thanks…
    Kyle C
    • 4,077
    • 2
    • 31
    • 34
    46
    votes
    2 answers

    build method on ruby on rails

    New to rails and I'm following the Depot project found in the Agile web development with rails 3.1. Everything was fine until I got lost when the book used the "build" method. @cart = current_cart product =…
    Finks
    • 1,661
    • 2
    • 16
    • 25
    45
    votes
    7 answers

    How do I write a Rails 3.1 engine controller test in rspec?

    I have written a Rails 3.1 engine with the namespace Posts. Hence, my controllers are found in app/controllers/posts/, my models in app/models/posts, etc. I can test the models just fine. The spec for one model looks like... module Posts describe…
    Martin Streicher
    • 1,983
    • 1
    • 18
    • 18
    45
    votes
    6 answers

    How to create a new DateTime object in a specific time zone (preferably the default time zone of my app, not UTC)?

    I have set the time zone in /config/application.rb, and I expect all times generated in my app to be in this time zone by default, yet when I create a new DateTime object (using .new), it creates it in GMT. How can I get it to be in my app's time…
    user664833
    • 18,397
    • 19
    • 91
    • 140
    45
    votes
    6 answers

    How to make Devise redirect after confirmation

    How can I create an after-confirmation redirect in Devise? Before I added the confirmation module the custom after_sign_up_path worked fine for the first time login/signup but now when I click the confirmation link in the email it redirects to the…
    js111
    • 1,304
    • 4
    • 30
    • 57
    43
    votes
    4 answers

    Rails how to sum columns?

    Example I have: @test = Pakke.find([[4], [5]]) In my Pakke table I have a column named prismd How do I sum the two values for the prismd columns for @test?
    Rails beginner
    • 14,321
    • 35
    • 137
    • 257
    42
    votes
    4 answers

    Ruby gem naming conventions

    I'm creating a ruby gem and I've noticed that there doesn't seem to be (to my knowledge) a naming convention for gems. For example, I've seen both: gem 'foo-bar' gem 'foo_bar' Is there some kind of definitive guide/convention for the naming of ruby…
    Kyle Decot
    • 20,715
    • 39
    • 142
    • 263
    42
    votes
    11 answers

    Rails: How to disable asterisk on form's required fields?

    When I add the 'Required' attribute to html input fields, Rails pre-pends an asterisk (*) before the label. Does anyone know how to prevent this? For some reason Rails transforms this: <%= f.input :Company, :input_html => {:value => "", :id =>…
    vsync
    • 118,978
    • 58
    • 307
    • 400
    41
    votes
    2 answers

    simple_forms custom data attribute

    I would like to have an additional data attribute on an input tag generated by simple_form. The following does not work: <%= f.input :date, :as => 'date_picker', :data => {:datepicker => :datepicker} %> How could this be done? Is it possible at…
    Ynv
    • 1,824
    • 3
    • 20
    • 29
    41
    votes
    3 answers

    ArgumentError: You need to supply at least one validation with :if

    I have a simple model class Task < ActiveRecord::Base validates :deadline, :if => :deadline_in_future? def deadline_in_future? Date.today < self.deadline end end All seems ok, but when I in my rails console irb(main):001:0>…
    Ximik
    • 2,435
    • 3
    • 27
    • 53
    41
    votes
    5 answers

    Rails 3.1 is very slow in development-mode because of assets, what to do?

    After I added Sprockets, Rails is loading very slow in development mode, what should I do to speed it up?
    jonepatr
    • 7,769
    • 7
    • 30
    • 53
    41
    votes
    1 answer

    How to include vendor js in Rails 3.1

    I have a js vendor script called Corners.js located in /vendor/assets/javascripts/ How do i include the js vendor script?
    Casper larsen
    • 411
    • 1
    • 4
    • 3
    41
    votes
    2 answers

    Add defer attribute to javascript_include_tag Rails

    Is there some way to add the defer attribute easily using the javascript_include_tag helper in Rails? I.e., is there some easy way to turn <%= javascript_include_tag "blah.js" %> into