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.

Filter by
Sorted by
Tagged with
4 votes
0 answers
1k views

Top level ::CompositeIO is deprecated, require 'multipart/post' and use `Multipart::Post::CompositeReadIO` instead

I am running an old project which is built in rails 3.1 and ruby-1.9.3. When I am trying to migrate my models, it is causing the following problem. rake db:migrate -> Top level ::CompositeIO is ...
Muhammad Ans's user avatar
32 votes
4 answers
7k views

Rails `require': cannot load such file -- matrix

after updating to ruby 3.1.2 and Rails 7.0.2.3 getting following error while starting rails application: `require': cannot load such file -- matrix (LoadError) what could be the possible solution, ...
vidur punj's user avatar
  • 5,237
18 votes
6 answers
20k views

How to set SameSite attribute to 'None; Secure' in Rails3.1.12 and Ruby1.9.3

A cookie associated with a cross-site resource at https://example.com/ was set without the SameSite attribute. It has been blocked, as Chrome now only delivers cookies with cross-site requests if they ...
Suresh Kumar's user avatar
1 vote
2 answers
2k views

How to get current and previous financial year Ruby?

How to get current and previous financial year datewise in ruby based on current date ? current_month = Time.current.month current_year = current_month > 3 ? Time.current.year :Time.current.year -...
Amol Mohite's user avatar
1 vote
0 answers
152 views

After including rails engine layout in application gives routing error?

I am using Rails 5.2.3 and ruby 2.4.0p0 I already have an rails application, now I have created a new Rails engine with some functionality I have included it in the main application as: In gemfile: ...
vidur punj's user avatar
  • 5,237
0 votes
2 answers
2k views

Multiple after_update callbacks with attribute change conditions are triggering only the first one

Multiple after_update callbacks with attribute change conditions are triggering only the first one. class Article < ActiveRecord::Base after_update :method_1, :if => proc{ |obj| obj....
webster's user avatar
  • 3,922
0 votes
0 answers
83 views

Manifest requires output filename

I'm using Rails 3.0.10 and running rake assets precompile at production server and facing problem as manifest requires output filename.this code is already deployed on heroku server and working fine. ...
Shashank M Tripathi's user avatar
0 votes
2 answers
2k views

index is getting called instead of show

I'm trying to write an API using Ruby on Rails. In my controller class index method is getting called instead of show. Although I am passing parameters. tried these urls http://localhost:3000/api/...
BlackBeard's user avatar
  • 10.3k
2 votes
0 answers
224 views

Tagged logging in Rails 3.1.12

I would like to know how the tagged logging can be implemented in Rails versions below 3.2. I have tried to override the logger.rb using a custom logger. lib/custom_logger.rb class CustomLogger < ...
Arun Mathew Kurian's user avatar
0 votes
1 answer
255 views

Namespaced models don't work with polymorphism and I need a workaround

Polymorphic relationships don't work when the models are namespaced in rails 3.1. Here is an example: class Accounting::Request::Check < ActiveRecord::Base has_one :accounting_request, as: :...
Nick Res's user avatar
  • 2,164
0 votes
0 answers
50 views

How we can upload multiple images on cloudinairy in slots with rails

My requirement is to upload multiple images on cloud in slots. For example i have 100 images in array then images goes in 3 - 3 slots on cloudinairy and and at the time of upload i have any error like ...
Ritu Rajora's user avatar
0 votes
3 answers
478 views

Rails: Mailer view with a different name from its action

I want to find the action mailer corresponding to a specific mailer view. It seems that there are no mailer action with the name of the mailer view's name. How can I find the mailer action in this ...
blu's user avatar
  • 167
0 votes
1 answer
125 views

Ruby On Rails error during run the project

I have cloned this project from gitlab , I tried to run this in locally but i cant able to run, when I tried to install bundle, this error is coming that i mentioned in above picture. Please some one ...
user7346035's user avatar
0 votes
2 answers
452 views

How to set website logo image on signup mail in rails?

I am using rails 5 when user is registered in my website i am sending an email for him for account approval.I want to set website logo with email. How we implement this in rails mailer view file ...
Ritu Rajora's user avatar
0 votes
0 answers
93 views

How To Download File In DWFX (AutoCad) Format In Rails Active Admin In Rails 4.2

Basically I am using gem 'activeadmin', github: 'Zhomart/active_admin', gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid', branch: 'mongoid-old' and gem 'mini_magick'. I am trying to ...
Ritu Rajora's user avatar
1 vote
1 answer
2k views

error precompiling assets when moving to production

I am trying to move my project to production, trying to RAILS_ENV=production bundle exec rake assets:precompile gives me an error, without specifying in which file it is. rake aborted! Sass::...
Kamal G'ool's user avatar
0 votes
2 answers
1k views

Rails - Override Alias method

This is a smelly code and the alias method has been used at many places . Now I would want to call the actuals rails .destory method thereby deleting all assocaited dependents of Books - Is there a ...
SureshCS's user avatar
  • 1,015
-1 votes
2 answers
64 views

rails how to get the following query in rails

I need to get the following output in rails how do i do it? SELECT "booking_rooms".* FROM "booking_rooms" INNER JOIN "bookings" ON "bookings"."id" = "booking_rooms"."booking_id" WHERE "...
edrich13's user avatar
  • 731
2 votes
2 answers
320 views

Disable first nil option - rails

Wondering if there is a way to disable only the first nil option in a list of options. There are multiple options with nil values. For example if we have options_for_select( [["first", nil], ["...
Siva's user avatar
  • 1,256
0 votes
0 answers
48 views

Model with huge number of fields

I have model Car and fields vin:uniq a_field1 a_field2 a_field3 .. a_field20 b_field1 b_field2 b_field3 .. b_field30. I have two kinds of users Mechanik and Manager. Mechanik can see and edit a_ ...
sssebaaa's user avatar
-2 votes
2 answers
580 views

Code Analyze and Optimization tools for Ruby on Rails?

I need to know tools available for performance analysis and optimization for Ruby on Rails like SonarQube in java. Note : I am not looking for Gems.
Dinesh Goyal's user avatar
0 votes
0 answers
494 views

Best use of content_tag in a custom link_to helper method

What is the best way to use a custom helper method in order to generate html tags with links and html options? lets say def drop_document_options(title,document,version,html_options) end in order ...
Kamal G'ool's user avatar
0 votes
0 answers
136 views

How to write the below SQL query in rails 3 ActiveRecord?

select * from ( SELECT DISTINCT ON (table1.id) table1.*, table3.date_filed as date_filed FROM table1 LEFT JOIN table2 ON table2.id = table1.some_id INNER JOIN table3 ON table2.id = ...
Jak's user avatar
  • 2,953
2 votes
1 answer
1k views

Multiple search fields in rails 4

Using Rails 4 and ruby 2.2, I have my User model which has following attributes username email active Now I need to create a search text field for username, email and drop down for ...
cyborg's user avatar
  • 870
0 votes
1 answer
491 views

Add attachment to email using action Mailer - Rails 4

I have book model which has title, page_no and description. There is another model Image. class Book < ActiveRecord::Base has_many :images, dependent: :destroy end class Image < ...
cyborg's user avatar
  • 870
1 vote
2 answers
52 views

User authentication and authorization for rails app [closed]

Excuse my lack of knowledge, Lately, I am learning rails and found it extremely easy and fun, but still there is alot to learn. I made an application for managing a Car workshop: Owners has many ...
Kamal G'ool's user avatar
1 vote
1 answer
257 views

validates_uniqueness_of when updating car.number

When updating car info, the validation process fails because I have validates_uniqueness_of :number class Car < ActiveRecord::Base validates :number,numericality: true, length: {is: 7 } validates :...
Kamal G'ool's user avatar
0 votes
1 answer
45 views

Custom user page for rails using devise - Using Rails 4 and Ruby - 2.2

I am currently using devise for authentication which generates user.rb and controller for user, Welcome page(root page after authentication) which is main page of application where I need to show the ...
cyborg's user avatar
  • 870
0 votes
1 answer
67 views

Multiple t.references get nil value for the second nested models

I have visits who belongs_to owner, and belongs_to car through two t.references, owner_id keeps getting nil when I create new visit through @car.visits.create. Visit.rb class Visit < ActiveRecord:...
Kamal G'ool's user avatar
0 votes
1 answer
74 views

fields that don't pass validations don't get .field_with_errors class

My validations work fine class Owner < ActiveRecord::Base validates :car_number, :name, :phone, presence:true validates_uniqueness_of :car_number has_many :cars has_many :visits ...
Kamal G'ool's user avatar
0 votes
1 answer
1k views

undefined method `to_i' for :offstfsal:Symbol

I am getting the error undefined method `to_i' for :offstfsal:Symbol in activeadmin. Looks like to_i has been removed. Any suggestion would be helpful. index :title => "Office Expenses" do ...
Vivek S's user avatar
  • 107
0 votes
1 answer
350 views

DEPRECATION `RSolr.escape` is deprecated (and incorrect). Use `Rsolr.solr_escape` instead

Project environment Ruby 1.9.3p392 Rails 3.1.12 gem 'sunspot_rails' , '2.0.0' gem 'sunspot_solr' , '2.0.0' [DEPRECATION] RSolr.escape is deprecated (and incorrect). Use Rsolr.solr_escape instead. ...
hgsongra's user avatar
  • 1,454
1 vote
2 answers
3k views

Ruby on Rails Active Record inner join not working

I have 2 models: Engagement, user. Engagement basically refers to the items booked by the user. each engagement is for a specific user. user in engagement has a foreign key. I want to join engagement ...
Euler's user avatar
  • 652
0 votes
0 answers
673 views

How multiply quantity and price in each item

In Rails, Can not multiply the quantity x price in each items, used in the model file. How multiply the quantity x price in Ruby, And further, if I can do in javascript oriented as the total of each ...
Croelanjr's user avatar
0 votes
1 answer
60 views

When I tried to create comment to micropost I have an error as "undefined method `comment_content'"

When I create a comment for micropost I have an error that "undefined method `comment_content'" and there is an problem on @comment.save method. Please help me to fix the problem. Thank you for your ...
Takor's user avatar
  • 277
1 vote
1 answer
554 views

Rails Model Validation converts & to &amp;

I disabled all the validations in the model but when i try to access the following. It converts string having & to & p = Project.new(title: 'With & character') p.valid? p.title => "...
kashif's user avatar
  • 1,117
2 votes
4 answers
2k views

Rails: multiple submit button outside simple form

Say I have an Article model, and in the Article model 'settings' view I have two submit buttons outside of a form, "update Details" and "Next Template". My question is how can I know which button is ...
Bharat  Bhushan's user avatar
1 vote
1 answer
297 views

Rails - adding new field to inherting class

I have Student model, inheriting User model class Student < User if I add new field to Student, its not showing up. All I see is replica of User fields in Student table. rails g model User email:...
Manjunath P's user avatar
2 votes
1 answer
624 views

Faye server not working

I am trying out the railscast episode of private_pub gem. I am not able run the faye server. After running this command: rackup private_pub.ru -s thin -E production I am getting the following error:...
webster's user avatar
  • 3,922
2 votes
1 answer
3k views

Carrierwave gem Video upload and thumbnail generation with rotation

I am using Carrierwave gem to upload video recorded from iPhone and create thumbnails of video uploaded using carrierwave-video-thumbnailer gem. Now I am facing issue with rotating thumbnail image ...
Shamith c's user avatar
  • 3,719
3 votes
1 answer
5k views

Devise ..After first login should ask for change password

I am using devise as authentication in my application. I need to implement feature in devise. After first login user should ask to change password. I tried through model after_create :...
sheetal's user avatar
  • 99
0 votes
1 answer
776 views

Rails -v command gives me rails isn't installed

However rails -v command gives me rails isn't installed,i found rails gem in this path /bundle/ruby/1.9.1/gems
Mohamed Hatem Abdu's user avatar
0 votes
3 answers
1k views

I can't find rails version on the server that host a rails website

First of all, I am newbie to rails. i have a website that is written in rails this website is hosted on Ubuntu 14.04 server.when i write rails -v it gives me. The program 'rails' can be found in ...
Mohamed Hatem Abdu's user avatar
0 votes
1 answer
941 views

Two forms, one submit rails

I have a problem with that: My first Form <div class="authform"> <h3>Edit <%= resource_name.to_s.humanize %></h3> <%= form_for(current_user, :url => ...
Miguel Abdon Hollstein's user avatar
0 votes
1 answer
112 views

rails showing error while starting rails server

Here i am trying to start ruby on rails server.but i am not able to start because of these following errors. how can i solve this? C:\Users\hazelnut\Desktop\wardrobe\wardrobe>rails server Could ...
Ceejay's user avatar
  • 7,009
2 votes
0 answers
179 views

Rails 3 select multiple values from table joined multiple times

Let's say I have ActiveRecord models A, B and C: class A < ActiveRecord::Base belongs_to :c has_one :b end class B < ActiveRecord::Base belongs_to :c end class C < ...
constantine1's user avatar
1 vote
1 answer
222 views

Cannot precompile all files (app\assets) in rails application though rake assets:precompile

I have a rails application and try to Run it to my local server on Win2012 now right. https://github.com/carloscoca/loccasions I tried to precompile all Files in app\assets though the command rake ...
Carlos Coca's user avatar
0 votes
1 answer
104 views

How to use join operation in rails to get desired result

I am new to Ruby-on-Rails I have following tables with below mentioned attributes Supplier - id ,name,address etc------ Variant - id ,price,etc--- SupplierVariant- supplier_id,variant_id LineItem -...
Shakthi's user avatar
  • 141
0 votes
1 answer
51 views

Give argument to action on Rails

How do I give an argument to my action of a controller. I have an action named action and a controller named controller. I want to give an argument to the action when I go to http://localhost:3000/...
Ayush Mishra's user avatar
4 votes
1 answer
245 views

Find Value by position on plain HTML in ruby

My Html file is not having any classes . I am trying to get the no. from the plain Html <html> <head></head> <body> PO Number : [4587958] </body> </html&...
SWagh's user avatar
  • 47

1
2 3 4 5
106