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.
0
votes
0answers
19 views
Rails 4 Devise error?
Hello I am working with Rails 4.0.0.rc1/Ruby 2.0.0p195, and I am using devise at gem 'devise', github: 'plataformatec/devise', branch: 'rails4'.. I keep getting this error when I want to migrate to ...
0
votes
0answers
11 views
how to get mini-profiler to start in rails
I've installed mini-profiler gem in a Rails 4 (rc1) application but when I load the application it's not showing the little window with load time statistics in the browser.
According to the Railscast ...
0
votes
0answers
7 views
MathJax, Rails 4, Markdown integration
Does anyone have an idea of how i can integrate:
Mathjax latest release(mathjax-MathJax-v2.2-8-g727332c), Rails 4 and Markdown?
This whole asset pipeline thing is making it hard for me to get to ...
0
votes
0answers
9 views
How to check for SQL IN clause of subset in Rails/ActiveRecord
I'm trying to do the following:
@recent_time_logs = TimeLog.where(location_id: current_user.locations).order('began_at desc').limit(10)
It works fine, but when I look at the SQL logs, I see it ...
0
votes
0answers
80 views
Rails 4: Multiple engines routing problems
I'm building multitenancy app in Rails 4 rc1 with multiple engines. But I have a routing problems between engines. Here is the my application structure.
hostapp/
admin/
frontend/
...
0
votes
1answer
28 views
Heroku Rails 4 / Ruby 2.0.0 Deploy Fail, Production Database is not connectable
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
could not connect to server: Connection refused
Is the server running on host ...
0
votes
1answer
13 views
Tried several fixes: Heroku/Rails 4 Assets Precompile Error
Looks like this is a common issue, so let me begin by saying I've done a lot of research already.
Following this thread, I ran
heroku labs:enable user-env-compile -a myapp
Then I made sure that ...
1
vote
2answers
18 views
Rails 4 calling nested associations
I'm pretty new to rails but started having this issue today which i haven't experienced before. Currently working on an application with a few nested associations. While i can create and add save ...
0
votes
1answer
21 views
Building associations in a before-filter in rails4
I am migrating an app from rails3.2.13 to rails4.0.0-rc1. I am having the following code:
class Foo < ActiveRecord::Base
has_many :bars
before_create :build_bars
private
def build_bars
...
0
votes
1answer
39 views
How to change bootstrap link_to color on navbar
How to change link_to color on navbar to make it look like this;
<a class='brand' href='#'>PROJECT_NAME</a>
so far i have
.brand
= link_to "PROJECT_NAME", root_path
but its still ...
0
votes
0answers
28 views
Rspec/Capybara doesn't know current_user
I have a Product model that belongs to a User, as an Owner. I test when the products are displayed in the product index page, a link to the delete action is present near the products the current user ...
0
votes
2answers
58 views
Why I can't install postgresql with rails 4.0.0.rc1 (ruby 2.0)
first time on forum so i will try to be as specific as one can be, sorry for any possible typos ok?
I am relatively new to rails (less than a year), and i want to make a default project to work with ...
-4
votes
1answer
62 views
Rails 3.2 vs 4.0 [closed]
I have some general questions about Rails 4.0:
From high, what will change?
The major version number increased, but from ruby 1.9 to 2.0 there aren't a really big external change, like 1.9 when ...
0
votes
1answer
25 views
How to add comments
I'm trying to add comments to post model. This is my comments_controller so far:
class CommentsController < ApplicationController
before_action :find_post
def index
@comments = ...
0
votes
0answers
19 views
File to import not found or unreadable: bootstrap-wysihtml5
I have a Rails 4rc1 application with multiple engines. I'm using bootstrap-wysihtml5-rails gem in my admin engine. According to documentation I added gem 'bootstrap-wysihtml5-rails' to admin engine's ...
0
votes
2answers
29 views
Submit button helper with I18n.t
I want to write a helper for a submit button, that takes in account the action (create or update) to get the right translation. Here they are :
fr:
submit:
create:
user: "Créer mon ...
0
votes
2answers
41 views
Capybara ambiguous match - should have_content
I'm using Capybara and Rspec in a Rails app, and I keep failing some of my tests with this message :
Failure/Error: it { should have_content('error') }
Capybara::Ambiguous:
Ambiguous match, found ...
0
votes
2answers
23 views
Get filename from model name in Rails (and vice versa)
Is there a way to go from a Rails model's filename (e.g. /app/models/foo/bar.rb) to its model name (e.g. Foo::Bar)? And/or vice-versa?
Or do I have to parse the strings to figure out what they ...
0
votes
0answers
26 views
Combining assets into a single file in Rails 4 development environment
I'm trying to extract all vendor assets into separate file and serve them as a minified and combined file also in development environment. I could do that in Rails 3 by using debug: true in ...
0
votes
0answers
18 views
Custom Tables in PaperTrail with Rails 4
I'm pretty new to Rails, and trying to use PaperTrail to handle versioning for all of my models. I'm using PostgreSQL. I want to store the versions table for each model as a separate table, which the ...
1
vote
1answer
36 views
Devise as a nested resource - Routes
I am working on a fairly simple app. The basics of which are that I have 2 models, one for departments (department.rb below) and one for users (user.rb below). Departments have many users and users ...
2
votes
1answer
63 views
Why I get mass-assignment error in double nested form?
Models
class Profile < ActiveRecord::Base
attr_accessible :available_at, :person_id, :person_attributes
belongs_to :person
accepts_nested_attributes_for :person
delegate :first_name, ...
0
votes
0answers
36 views
Is better way to simulate enum column type in Rails 4?
I have following model.
class Company < ActiveRecord::Base
COMPANY_TYPE = { intern: 0, freelancer: 1, affiliate: 2, partner: 3, other: 4 }
attr_accessible :name, :company_type
def ...
1
vote
0answers
19 views
Unexpected Params in Rails 4 controller action
So I have a controller in a new rails 4 app which receives a JSON POST call from another application, which is sending minimal params through RestClient:
{
value: 2
user_email: ...
0
votes
2answers
19 views
Name capitalization in devise
I have problem with name capitalization. Should I use before_save callback?
I added 2 columns to model generated by devise - first_name and last_name. What now? help please:)
1
vote
1answer
83 views
Ruby 2.0 + Rails 4.0.0.RC1 + bootstrap + Heroku
Just started a new app and wanted to try Rails 4.0.0.RC1
After reading some migration tutorials on the topic, I have the app working in development with Ruby 2.0, Rails 4.0.0.RC1, Boostrap with Sass, ...
0
votes
0answers
27 views
Rails4: Ember Handlebars not present in Ember.TEMPLATES
I just upgraded to Rails 4.0
The templates are not getting loaded and Ember.TEMPLATES is not showing any of the templates.
Only templates those are embedded in HTML are getting reflected into ...
2
votes
1answer
22 views
Ruby on Rails: Getting Params from URL
On Rails 4, I am having trouble getting the params from a URL in my controller.
I have two models with a has_many and belongs_to association, let's call them Books and Pages. I want to create a new ...
2
votes
2answers
43 views
sending multiple parameters to another function in ruby
I'm trying to create a function that adds some functionality to the link_to function in rails. What I'd like it to do is simply to add a class to it. What I have so far:
#application_helper.rb
def ...
0
votes
2answers
20 views
Scheduling and fetching data in Rails
I'm working on an application that fetched data from X remote API's.
Currently I'm running a cron job every 2 minutes that executes a rake task for each of the API's but I feel that even if this is a ...
1
vote
2answers
50 views
How to setup a new ruby2+rails4 environment?
What should I notice, or say what's the different with setup a ruby 1.9 + rails 3 environment?
1
vote
2answers
25 views
Rspec not generating *_spec.rb file in Rails 4 beta
I have already install rspec-rails gem. When I run rails g model movie showtime_date:date showtime_time:time I think, I should get
invoke active_record
create ...
0
votes
0answers
11 views
Converting TIFF Images Using Carrierwave
I am currently using Carrierwave and Mini_Magick to handle my image uploads.
I have a conversion in place for all image uploads
Uploader
def preview_conversion(width, height)
manipulate! do ...
0
votes
1answer
62 views
Trouble with Rails Version 4.0.0.rc1
Ok, I'm trying to follow along with Rails in Action 4 book.
Am currently on chapter 3
This is what the Gemfile is supposed to be:
source 'https://rubygems.org'
gem 'rails', '4.0.0'
gem 'sqlite3'
...
0
votes
1answer
31 views
How to update my Users/Products association
I'm trying to create an app to share or give products. So I have two models : User and Product.
A user can have many products, as an owner or as a borrower. A product has only one owner and only one ...
1
vote
1answer
30 views
rails4 error on association build or create when using before_filter
i have this assocaition:
has_many :exam_portions, -> { order :position }
belongs_to :exam
in exam_portion there are before_save callback:
before_create :proper_position
private
def ...
0
votes
1answer
31 views
Rails best practices : Public methods in model
I'm a newbie and I'm wondering if my app is going to fail is a near future because I don't understand all subtleties of Rails. So I prefer to ask you :-)
I have a User and a Product model, and I want ...
0
votes
0answers
28 views
Rails 4 and FactoryGirl traits creation
We are migrate rails3 app to Rails4. In FactoryGirl we use this trait:
trait :with_student do
after_create do |resource|
resource.students << FactoryGirl.create(:student)
end
...
-1
votes
1answer
34 views
autocomplete through Array of strings in Rails 4
I'm using this gist to build autocomplete functionality in my Rails app.
I'm saving record in Shoe model attribute like below
"nike air, nike steam,nike softy ,nike strength" #comma separated words
...
0
votes
0answers
20 views
Rails 4 + Angular Nested Attributes
I have a new Rails 4 App where I am attempting to use Angular primarily on the front-end.
I have the following:
Board.rb
class Board < ActiveRecord::Base
belongs_to :organization
...
-1
votes
1answer
33 views
Can't create new post
When I click submit button it creates post with empty values. No problem when i create post in rails console. Any ideas?
_form.html.erb
<%= form_for(@post) do |f| %>
<div class="field">
...
0
votes
1answer
38 views
How can I sort ActiveRecord Objects by id array
My Env.
ruby 2.0.0-p195
rails (4.0.0.rc1)
activerecord (4.0.0.rc1)
I want to sort ActiveRecord Objects by id array.
I tried with order by field.
ids = [1,4,2,3]
Foo.where(id: ids).order('FIELD(id, ...
0
votes
2answers
28 views
Rails images and assets not being loaded properly
For example, in my Rails application I have something like:
.wax_seal {
background: url("wax-seal-small.png");
display: block;
height: 100px;
margin: 0 auto;
width: 92px;
}
...
2
votes
3answers
82 views
+50
Extract rails db to JSON file
How can I extract the data in the rails sqlite3 db to a JSON file?
I'm using rails 4. I would like to extract all the data in my database so I can reload later when reset my database or when I switch ...
0
votes
1answer
26 views
Rails 4 and RSpec, undefined method `assertions' in routing spec
I'm having what appears to be the same issue as undefined method `assertions' in routing spec but I'm running Rails 4 and it is locked to minitest 5.0 or greater. Thus the solution to use minitest ...
1
vote
0answers
102 views
Rails 4 RSpec warning: you should require 'minitest/autorun' instead
In trying to run RSpec on Rails 4, I immediately get a warning:
you should require 'minitest/autorun' instead
that comes up in the backtrace assigned to the line
require 'rspec/rails'
in ...
0
votes
1answer
33 views
Rails 4 - Validate Model without a database
I've followed this tutorial and molding it as best I can for Rails 4.
http://railscasts.com/episodes/219-active-model?language=en&view=asciicast
class Contact
include ...
0
votes
2answers
39 views
Wrong action being generated for form_for on edit
The action for my edit form is being generated wrong. The way I built the model was a little different than usual, I first generated the model using:
rails g model category name:string ...
0
votes
2answers
26 views
Custom user fields in Devise 3 under Rails 4
I'm using the release candidate of Devise 3 so that I can use it with Rails 4. In Rails 3.2 I used to be able to add a custom field to my User model by simply adding that field to the ...
0
votes
0answers
11 views
Event Calendar Height Adjust When Events Are Added
I am currently using https://github.com/elevation/event_calendar in my application.
I know the default height is 500px. When I add weekly events to my calendar, once it reaches like 3 events the ...