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 now available.

learn more… | top users | synonyms (2)

0
votes
5answers
13 views

Rails: How to prevent unauthorized access of controller update action

Hi I am new to rails and I am trying to figure out how to prevent unauthorized access to the update action of a controller. I know I could have a before_filer that kicks out people that arent logged ...
0
votes
0answers
2 views

In Refinery CMS, how can I export data from one instance of my application to another?

What I'm really trying to do is set up a seed file with basic user and page data that can be imported each time I deploy my app. Because the Refinery models aren't found in the conventional Rails ...
0
votes
0answers
6 views

text_field_tag with empty string?

in my edit.html.erb, i have a code: <%= text_field_tag 'dams_provenance_collection[noteType][]', @dams_provenance_collection.noteType[0], class: "input-block-level" %> If I input any string ...
0
votes
1answer
22 views

Postgres on Rails FATAL: database does not exist

I've reinstalled Postgres (9.2.4) and I'm having trouble getting it set back up with Rails 3.2.11. I did: brew install postgresql initdb /usr/local/var/postgres pg_ctl -D /usr/local/var/postgres -l ...
0
votes
0answers
10 views

Paperclip error - Can't mass-assign protected attributes

I know there are a couple questions around this topic, one is almost identical since we followed the same tutorial, but none of the answers are working for me. I followed emerson lackey's tutorial on ...
0
votes
0answers
13 views

Ranking Topics by created_at, likes and number of comments

I'm looking to create a way to rank topics that are posted by users. I am using this right now: Topic.select("topics.*, (((topics.likes_count - 1) / POW(((EXTRACT(EPOCH FROM ...
0
votes
2answers
17 views

Change rails time formatting

I have some times that I am showing in my view <td><%= something.foo_time %></td> <td><%= something.bar_time %></td> Right now they display as 2000-01-01 ...
1
vote
1answer
12 views

How to define Flash Notifications with Twitter Bootstrap Rails gem

I am trying to set flash notifications in the controller but it seems like I can only define :notice. When I try to define :errors or flash[:errors] I've gotten a bunch of errors. I currently have ...
0
votes
0answers
10 views

Speeding up queries in pg_search that use associations

I have a Rails app that uses the pg_search gem to leverage the Full Text Search capabilities of PostgreSQL. In the manual it says, about searching a model that has (for instance) a has_many relation: ...
0
votes
0answers
13 views

Twitter Bootstrap Icons + Simple Form Collection (Rails)

I am trying to have a collection for simple form display twitter bootstrap icons in the options. Currently I have the following: home_controller.rb class HomeController < ApplicationController ...
0
votes
2answers
31 views

Can't override URL encoding for parameters

I've got a string that I want added to a URL variable, but I can't get Rails to not encode it. Here's what I've got: <%= link_to "Example", example_path(@resource, email: '*|EMAIL|*') %> ...
0
votes
0answers
4 views

Export docx to zipped html using google drive API

I am trying to export a docx file to zipped html using Google Drive API (Save as zipped html is one of the feature of google docs). But as per the documentation, supported export mime types are. ...
0
votes
0answers
16 views

Please, help me in AndroidAnnotations. Create correct JSON

I created my interface Rest @Rest(rootUrl="http://192.168.0.142:3000", converters={GsonHttpMessageConverter.class}) public interface UserRestClient { @Post("/api/v1/registrations/") ...
0
votes
1answer
15 views

how to change the domain using rails path helper?

So Rails provides these path helpers, for example, I can, in a view file, have <%= link_to "edit", edit_admin_article_path(article) %> This would work both in development environment ...
0
votes
0answers
14 views

How to make methods inside engine's application controller accessible for parent application?

I'm writing an engine that has a few methods inside application_controller that need to be accessible for the parent app that has the engine loaded through the Gemfile (full engine). Is there any way ...
0
votes
0answers
8 views

prevent DataTables from resetting scroll position on ajax reload

I'm using datatables with an ajax source to populate a table in my Rails app. The problem I'm having is that when the reload function is called (I have a timer set to call it every two seconds) the ...
1
vote
1answer
41 views

Generate the URL for a generic path with possible options in Rails

I'm creating a customisable nav menu for our site and have run into the following problem. I need to generate a URL to any controller and action on the site and optionally pass it parameters. I was ...
0
votes
0answers
10 views

Remember Me option with devise rails3

I have used devise 2.2.4, On login page remember_me option is not working. It is also not throwing any error, neither it is saving anything in remember_at field in user table. class User < ...
1
vote
0answers
11 views

Gitlab in a subdirectory with apache and passenger

I'm attempting to set up gitlab so that it is accessible through a subdirectory of an existing apache server, example.com/gitlab, for example. I am trying to use passenger, as this seems to be the ...
0
votes
2answers
11 views

Filter nil and empty values from an array in rails 3.2

I have a table called Materials and I have created a search form. In the form I want to have select boxes containing the names of the search options. So for example, if you want to search by subject, ...
0
votes
1answer
13 views

How a code can be assigned to an Application custom error messages

How a code can be given to an Application custom error messages in Ruby on Rails. when a user sees an error, he should be able to know both its error code and message. For example, I want to achieve ...
0
votes
1answer
15 views

rails object expected got string in Rails 3

class Result < ActiveRecord::Base has_one :p1, :class_name => "Player", :foreign_key => 'player_id', :validate => true end When i try to create a new record by using Result.new it ...
0
votes
1answer
27 views

Heroku: rake aborted

I'm trying to run db:migrate on Heroku (app's working fine locally) and I get this error: rake aborted! uninitialized constant Bootstrap::Rails::Engine::Sass ...
0
votes
1answer
8 views

ActionMailer Rails 3

this is my first time using ActionMailer. I have a hard time set the sender email. This is my development.rb : config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { ...
0
votes
3answers
39 views

match all in active record relations in a query

I need an activerecord query to Match ALL items in a params array. lets say user has_many roles. and each role has a name. when i pass ['actor', 'producer', 'singer']. I expect the query to return ...
0
votes
1answer
15 views

rails mongomapper get records with associated objects

I need to return records from app to another app. I want my queries to return also associated objects: Comment.where(:post_id => some_id).all What I get: {:comment_id => ..., :name => ...
-3
votes
0answers
52 views

Ruby string operation [on hold]

i am using nokogiri for html parsing. page = Nokogiri::HTML(open("http://www.google.com/index.html")); now in page i get the response like this <html> <body> Lots of html code ...
0
votes
1answer
8 views

Detect User's timezone in Ruby on Rails 3 without using external web services

i'm looking for a way to detect the user's timezone given their IP address and long/lat location (via geocode gem). I've found a lot of solutions on the net but most of them requires external web ...
-1
votes
1answer
35 views

undefined local variable or method in rails

In my rails application I have two tables named coordinates and tweets .To fetch queries the condition is decided in the coordinates controller and executed in the tweets controller. Its basically a ...
0
votes
1answer
11 views

Is there a way to pass params when clicking submit button in simple_form view in rails 3.2.12?

In simple_form view, the submit button is like this: <%= f.button :submit, 'Save' %> We are trying to pass a params subaction when clicking the Save button. The params[:subaction] should have ...
0
votes
1answer
28 views

Mass assignment fails when upgrading to Rails 4

deprecated_mass_assignment_security.rb:17:in `attr_accessible': `attr_accessible` is extracted out of Rails into a gem. Please use new recommended protection model for params(strong_parameters) or add ...
0
votes
1answer
31 views

How should I pass info through email headers in Rails 3

I'm working on a support app which would allow customers to mail to [email protected] and reply to this same email address. I have set up ticket+[id]@myapp.com to be visible within the support team ...
0
votes
1answer
10 views

Upload ActionDispatch::Http::UploadedFile To Amazon S3

How can I upload a ActionDispatch::Http::UploadedFile to Amazon S3? @file_data = params[:upload][:file] s3 = AWS::S3.new obj = s3.buckets['WeMake'].objects.create("video", file) I then get this ...
0
votes
1answer
17 views

How to refresh data during a long request in Ruby on Rails 3

The scenario is user can click a button and call a method, the method will run a python script, and the script will execute about 1~2 minute and during the execution time, I want to update the results ...
0
votes
2answers
21 views

undefined method `title' for nil:NilClass

Not sure why I'm getting this error message in development as it was just working a minute ago, and is still working in production. All associations are intact, don't know where this message came ...
0
votes
2answers
17 views

How to display latest posted?

So, I have an app that allows users to upload songs and vote them up. The songs with the higher vote count end up on top, and the newly posted songs need to be voted up to be seen (think hackernews). ...
0
votes
0answers
23 views

rails localization of date format gives unexpected results

For some reason I18n.localize(DateTime) is not returning what i expect it to. for example: I18n.localize(Date.today, :format => '%b') => "d" Date.today.strftime('%b') => "Jul" Why ...
0
votes
0answers
23 views

Rails not reloading classes

I have a rails app in development mode that is not reloading any model/controller classes upon modifying the files unless the dev server is reset. The same exact project used to reload the files fine ...
-1
votes
0answers
20 views

Where can I find a cross browser compatible audio player? [on hold]

So, I'm using Paperclip to upload audio files and I'm using the HTML audio_tag to play them, albeit, the audio player is only supported on Chrome, IE, and Safari. Is there an audio player gem I would ...
0
votes
1answer
11 views

can't seem to get rails association to limit columns with json

I have a restaurant application i am building that allows restaurants to create menus online. Right now our page loads 6 items on initial page load, and then an infinite scroll interaction takes over ...
1
vote
1answer
19 views

How does thumbs up 'plusminus' work?

So, I've followed the instructions seen here on tallying votes using the plusminus column, however it doesn't work. When I click to vote up, the vote is added but not ranked according to higher/lower ...
0
votes
1answer
10 views

Create link to new controller dokumente

Ive created an new controller: rails g controller dokumente index Added to my routes: get "dokumente/index" And now i tried to link to this site but always get an route error! So how do i have ...
0
votes
1answer
12 views

Reuse browser sessions with Selenium Webdriver in Rails app

I've created a Rails app that takes screenshots using URLs from users. The app uses delayed_job to queue jobs and then Selenium Webdriver and Firefox to take the screenshot. Right now however I have ...
0
votes
0answers
13 views

set_timezone error for scottwater/detect_timezone_rails

I gem installed https://github.com/scottwater/detect_timezone_rails I want my web app to detect users timezone automatically. Well, I keep getting this error Uncaught TypeError: Object [object ...
0
votes
0answers
15 views

Advice needed for Ruby On Rails 3 app

I have a small app just like user portfolio to upload profile pictures and few documents, I am using sqlite3 db. What do you think would be best option for me to select host. I checked DreamHost, but ...
0
votes
1answer
24 views

How to cache a query for each user for 24 hours?

Caching seems very complicated to me. There are too many ways to cache and I am certainly not able to follow any of them. In my app, for each user, on his profile I am displaying 24 random users: ...
1
vote
2answers
39 views

Rails test database not properly prepared

I have strange problem with properly preparing test database in Rails3. In schema.rb I have: create_table "sites", :force => true do |t| t.string "ldap_dn", :null => false t.string ...
-1
votes
0answers
8 views

Cannot load such file rack/handler/console when attempting rails console in heroku

My rails app was working just fine in Heroku. I made a deployment (via git), ran rake db:migrate, and restarted my app. Now, I'm trying to run "heroku run rails console", and I get this error: ...
0
votes
1answer
33 views

Rails Caching Strategy for Index action

In my User Index action I am running a query which finds all Users who belong to the same city as the current_user and the opposite gender and sorts the result by profile_update_at in DESC order. The ...
0
votes
1answer
41 views

Why does mongomapper hit the database twice on query?

I have a simple query: Store.where( params[:conditions] || {}).all In logs ,it appears that mongo mapper is firing the same query twice. 2013-07-28 14:01:05 - [DEBUG]: MONGODB (0.7ms) ...

1 2 3 4 5 918
15 30 50 per page