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
2answers
15 views
truncate all data in model and restart the id
I have several records in my Category model. All of them are test data. Now I want to clear the data.
if I issue Category.destroy_all or Category.delete_all all the records are deleted. However, any ...
0
votes
1answer
12 views
Devise: I added a username field, but it's not working
I've added my a username field to my User model, but it seems that devise isn't recognizing it when creating a new user record. I fill out the email, username and password, but I get a validation ...
0
votes
1answer
8 views
getting parent in self referential model
Based on http://guides.rubyonrails.org/association_basics.html#self-joins
I created a self join model called Category
rails g model Category name parent_id:integer
I altered the model category.rb ...
0
votes
0answers
3 views
Rails 4 Css undefined method `empty?' for 10:Sass::Script::Number
I just started a Rails 4 pet project this month, and I kept running in to a weird problem,
undefined method `empty?' for 10:Sass::Script::Number
(in ...
0
votes
0answers
9 views
How to populate an app with blog feeds?
Sorry for the verbose title.
So, I have an project seen here: www.leapfm.com that allows users to upload and vote up songs.
However, the app will only be useful if users are constantly adding new ...
1
vote
1answer
11 views
Rails 4: find all records
Now that ActiveRecord::Relation#all is deprecated in Rails 4, how are you supposed to iterate all records?
Used to be like:
Foo.all.each do |foo|
# whatever
end
I can approximate it now like ...
0
votes
0answers
2 views
Rails 4.0 redirects to 404 even though data exists
When I was running through my rails show page in Rails 4.0, I noticed that each time no matter if the id is nil or not, it redirects towards the 404.html page. While this is good and all for the nil ...
1
vote
1answer
53 views
ActiveRecord::RecordNotFound (Couldn't find all Songs with IDs (7, 9, 10, 18, 44, 46, 47, 55) (found 4 results, but was looking for 8)):
So, I had a friend help me get Omniauth-twitter working. However, now I've got serious issue. In order to get Omniauth working we had to change the primary_key on the users table to :uid instead of ...
0
votes
1answer
17 views
Upgrading Application to Rails 4 issues
I've recently upgraded my rails 3.2 project to 4.0. I've been successful in upgrading my app for the most part by following the guides. I have a few issues that I'm not sure what direction I should go ...
0
votes
0answers
4 views
Rails 4 with Clearance password reset issue
I'm building an Rails 4 app with the authentication gem 'clearance'. I'm kind of stuck with the following problem:
When an user forgets his/her password and would like to set a new password, the user ...
0
votes
0answers
6 views
content types using postgres hstore
In my project there are several types of content like event, project, article, blog, receipe. And each of these content types have a need for additional set of fields in their model like event content ...
0
votes
1answer
7 views
Rails 4: collection_select not inserting 'class' attribute?
What am I missing here? I am working with Rails 4.0.0 and trying out the new Bootstrap 3.0.0rc1. I have a simple 'recipe box' app that has a Recipe model and a Category model that feeds a 'category' ...
1
vote
1answer
20 views
Auto correct spelling while searching a Rails Model?
Is there a way (a gem) to correct spelling mistakes and give similar results when using rails where or find functions in a model?
0
votes
1answer
16 views
where.not() not working on arrays
I have an array called user_ids and I want to select the records whose user_ids are not in the array.
Here is what I used:
MyModel.where.not(user_id: user_ids)
But I got Error wrong number of ...
1
vote
1answer
28 views
How can I write a down or reversible function in this migration?
So, in-case this migration causes any errors I'd like to be able to revert back/rake db:rollback.
The code:
class ChangeUidToPrimaryKey < ActiveRecord::Migration
def change
execute ALTER TABLE ...