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. Ruby on Rails 4.0 is the latest edge version available.

learn more… | top users | synonyms (3)

0
votes
0answers
7 views

Rails validation :if not working

I'm trying to validate a model attribute based on a simple condition as shown in the rails docs. I have a quiz model with a boolean "show_birthday" attribute, and a participant model with a birthday ...
0
votes
1answer
756 views

Setting Cookies with Poltergeist PhantomJS Capybara Driver

I'm running to issues attempting to set cookies using the Poltergeist gem, and from reading through the closed issues at the Poltergeist gem, it appears this is a user error issue on my part, but I've ...
0
votes
1answer
20 views

Instance variables set in callbacks being set multiple times

I have two classes, a parent and a child, simplified below. class Parent < ActiveRecord::Base has_one :child accepts_nested_attributes_for :child validates :child, :presence => true ...
0
votes
1answer
17 views

Datatables without gem?

Is there any way to implement datatables without using gem?. I was following railscast tutorial for datatables, But then I realized there is no application.css file in the project that I am currently ...
0
votes
0answers
8 views

Connecting Ruby on Rails to an External Database

I have an MSSQL external DB and I need to connect to it. I made a new entry in the database.yml external_database: adapter: sqlserver host: xxx.xxx.xxx.xxx database: Trader username: ...
0
votes
1answer
11 views

Only displaying certain entries from a log based on id

I have a log in my webapp where you can input hours, and when you input your hours it automatically takes the account you are logged into(built using devise and cancan), and finds what your user_id is ...
3
votes
1answer
46 views

Is it possible to iterate 3 arrays in ruby at the same time?

We can iterate 2 arrays at the same time using zip method like: @budget.zip(@actual).each do |budget, actual| ... end Is it possible to iterate 3 arrays? Can we use transpose method to do the ...
0
votes
0answers
8 views
+100

Rails geocoding only allowing one attribute?

I am trying to get the latitude and longitude values for two different values. These are set in the attributes start and end in my Mileage model. geocoded_by :end, :latitude => :latitude, ...
0
votes
0answers
6 views

Rails Mongodb Map/Reduce Get sum per type

What's the best way to get a sum/average/min/max per type in a mongo collection? { _id: ObjectId("51b7d68d791e4b49b600000d"), car_type: "Volvo", value: "100" } My records look like that ^. I ...
1
vote
3answers
212 views

Nested form losing data

Sadly loses my form after unsuccessful validation the data which have the user typed in. How can I change this, so that the form doesn't losing the data? View _form.html.erb: <%= form_for(@user, ...
0
votes
1answer
15 views

Rails 3 update or create mass assigment

In a mass assignment I want either update or create. Update is working. How to create? def thing` @project = Project.find(params[:id]) @projecthours = @project.project_hours 20.times ...
1
vote
2answers
34 views

Rails - Where to put third party service calls?

I have a Payment model for my application, which is fairly straightforward. However, a necessary condition of adding a new payment is that a third party service call (creating a record with our ...
0
votes
0answers
9 views

How to specify a template in a transational email with mailjet

I am using the mailjet gem in my rails app. In the Gemfile gem 'mailjet' And some config: initializers/mailjet.rb Mailjet.configure do |config| config.api_key = 'your-api-key' ...
0
votes
1answer
29 views

How check if the column has Unique values?

There is a revenue model belonging to estate and revenue model have a column Year, before saving the new revenues to the revenue model, I want to check if the current value of revenue is Year already ...
0
votes
0answers
7 views

how to enable “Mail Method” in spree?

config/initializers/spree.rb Spree.config do |config| config.override_actionmailer_config = false config.mails_from = "[email protected]" end I tried above code, but it ...

1 2 3 4 5 2960
15 30 50 per page