Tagged Questions
0
votes
1answer
19 views
“bundle exec rake db:test:prepare” vs “bundle exec rake db:populate”
I'm going through Michael Hartl's tutorial and I'm unsure what the difference between these 2 commands is. Generally, in the tutorial, there's always 3 steps.
1. bundle exec rake db:reset
This ...
0
votes
0answers
14 views
ruby rails: task to rebuild index?
I'm currently using Apache derby database. Part of the recommendation is to continually rebuild the index (eg drop and add index) for better performance.
The way I approached this is to create a ...
0
votes
1answer
39 views
Creating an auto-updating list in Rails
I have three relevant models:
class InventoryItem < ActiveRecord::Base
belongs_to :item, :foreign_key => :item_id
belongs_to :vendor
has_many :shopping_list_items
class ...
1
vote
1answer
24 views
Rails: saving a range of values in a single field
I have a form where a user can make a workout. The workout has_many exercises that have the following parameters:
name: Bench Press
sets: 3
repetitions: 12
rest_time: 60 seconds
What I’m trying to ...
0
votes
1answer
24 views
Is it possible to view a remote database in heroku on my computer (using Induction)?
In my rails 4 application directory, I typed "heroku pg:credentials DATABASE" into terminal to get all the information about the database for my application which is deployed on heroku. Since I'd like ...
2
votes
1answer
20 views
When Should Data be Included in its own Model in Rails?
When should Data be included in its own Model in Rails and when can it just be added as a column to a current Model?
For example, lets say I want to add a Paid Membership option to Users. Should I ...
0
votes
0answers
21 views
Ruby rails: how to write a rake task to rebuild database index? [on hold]
I'm currently using Apache derby database. Part of the recommendation is to continually rebuild the index (eg drop and add index) for better performance.
The way I approached this is to create a ...
-1
votes
1answer
24 views
Mysql migration error
I'm recieveing the following error when trying to migrate my database.
Mysql2::Error: BLOB/TEXT column 'overview' can't have a default value: ALTER TABLE `habitat_versions` CHANGE `description` ...
0
votes
1answer
30 views
Rails - how to save data to database with Delayed Job?
I am authenticating users through Facebook and I would like to store person's friends in database. Because people can have up to 5000 friends on FB and I would like to save these 5000 people into our ...
0
votes
1answer
13 views
Assign value to checkbox from database pull
I'm trying to add a value to my checkbox. But It's not there when I'm trying to view it via inspect element. Here's how I do it.
Database select:
@amenities = ...
0
votes
1answer
38 views
How to add a new column correctly within a rails application without relying on migrations?
Lets say user Bob wants to keep track of his meals calories every day, which are currently breakfast, lunch, dinner, and a snack. So I make a table within rails containing four columns (breakfast, ...
0
votes
2answers
34 views
Query in rails 3
I want to run a query on my User model, like this:
@user = User.find(:all, :conditions=>["u_org != c_org and u_org == ?", current_web.role.id])
This is the older style for running queries and it ...
0
votes
1answer
15 views
Rails undefined method?
I can't figure out for the life of me why is this crashing. I have read tons of guides on stackoverflow and google searches and they all say the same thing which is what I am doing.
Here is the ...
1
vote
3answers
30 views
Rails checking if a record exists in database
What is the most efficient of way of checking if a database will return a record before processing it. Example: Truck.where("id = ?", id).select('truck_no').first.truck_no
This may or may not return ...
0
votes
1answer
14 views
Does HABTM jointable needs index?
Is it necessary to add_index on HABTM join table? I use t.belongs_to (aka t.references). Here is code
class CreateCohortsUsersTable < ActiveRecord::Migration
def change
create_table ...