Reset the database (purge all), then seed a database
Is there a rake command to wipe out the data in the database tables? how do I create a db:seed script to pre-install data to my tables? ...
Is there a rake command to wipe out the data in the database tables? how do I create a db:seed script to pre-install data to my tables? ...
I want to create a security field in the column, which will be used to do bit 'banging' what data type should I use in my migration? ...
I tried to instal dalecook actionwebservice (this is updated datanoise's version 2.3.2 to 2.3.5), with command: sudo gem install actionwebservice --source gems.github.com I tried too: dalecook-actionwebservice instead actionwebservice or http://github.com/dalecook/actionwebservice instead gem.github.com and resut is the same ERROR:...
This question is regarding the html form in RSpec book (beta version b15_0), page: 301. The best way I could figure for that problem is this: <p> <%= f.label :genres %><br /> <%- @genres.each do |genre| %> <%= check_box_tag(genre.name, genre.id) %> <%= label_tag(genre.name) %><br /> <%- end %> </p> This forces me to chec...
I use rails with jQuery. a scenario like that def method_1 respond_to |format| format.html {} format.json {return the calculate value} end the method recieve a couple of different params, and calculate different value. so when user browser method_1/1 and jQuery code in method_1 view can receive the format.json value, when user brow...
I want to create a database field to store a GUID. I did this: add_column :users, :user_guid, :string, :length => 36 But it just created a column of varchar(255) ...
I have users, posts and comments. User can post only one comment to each post. class User < ActiveRecord::Base has_many :posts has_many :comments end class Post < ActiveRecord::Base has_many :comments belongs_to :user end class Comment < ActiveRecord::Base belongs_to :user belongs_to :post end On userpage (http://host/us...
This seemed trivial at first, but I can't get it right for some time now. The relation is trivial. class Project < ActiveRecord::Base has_many :tasks end class Task < ActiveRecord::Base belongs_to :project end Now I would simply want to get all the Projects which have 1 or more tasks associated. Now to do this without any extende...
I would like to return a string from a model, which can be used directly in the liquid-based template. The problem is, that I would like the string to be translated using gettext. I cannot use _("string") right into model.to_liquid, because it doesn't work. As far as I understand, the model is loaded once, and it will always return the...
I've been pulling my hair out for 14 hours trying to figure out what is going on with this app...which has been running fine for weeks. If anyone sees anything in this backtrace and can provide some insight I would be forever in your debt: ==> production.log <== # Logfile created on Sat Oct 23 08:23:42 -0700 2010 ==> dyno-2162168.log <...
I would like to switch to rails 3, but I think it is not doable at the moment. Currently I am running the following stack (which works ok for me): Windows XP (Service Pack 3, please don't laugh) Rails 2.3.5 Mongrel 1.1.5 Mongrel_service 0.3.4 Ruby 1.8.7, P249 I want to run two Rails apps as a service, so I don't need to think about s...
I added config.gem "ruby-hmac" in environment.rb Then I run: rake gems:unpack Then rake:gems:install But when I ruby script:server I always got this error message: Missing these required gems: ruby-hmac You're running: ruby 1.8.7.249 at /Users/macbookpro/.rvm/rubies/ruby-1.8.7-p249/bin/ruby rubygems 1.3.6 at /Users/macbookpr...
This is more of a design question. I have several places in models were I have records that have only a certain amount of option for them, for example: Sex: There is only 2 options (male, female) Level: There is only 3 options (silver, gold, platinum) Country: There is only a limited amount of countries. My question is what is the righ...
I have some configuration values in a YAML file that needs loaded when my app starts up. The values need to be accessed in a few different places (both in a few models and a few controllers). What is the best way to load, store, and access these? ...
Can anyone point to some resource which shows how the tables are set up ( for MySQL for example ), on each of the Rails associations ( one to one, one-to-many, many to many ). I understand how the associations work from a Rails point of view, but I don't understand how they work from the database's side. ...
I am trying to write this: post_view.id = 1 Comment.find(:all, :conditions => "post_parent_id = 'post_view.id'").size The second statement does not work because that is not an appropriate way to write post_view.id . Anyoone know the proper syntax? ...
I'm trying to get will paginate to link to my nested route instead of the regular posts variable. I know I'm supposed to pass some params to paginate but I don't know how to pass them. Basically there is an array stored in @posts and the other param paginate has access to is category_id. The nested route is /category/1/posts but hittin...
Do the latest versions of these gems not work with each other any more? It appears that something may have gotten out of whack in my bundle. undefined local variable or method `node' for #<Capybara::Driver::RackTest::Node:0x103e19390> (NameError) ./features/step_definitions/web_steps.rb:35 ./features/step_definitions/web_steps.rb:14:in ...
I have this, and it works but it's pretty obtrusive. I am essentially mimicking tabs where each one holds one step in a 5 step process. If the previous step has been completed then I want the tab text to be a link, otherwise just text without a link. So the first step might be to select a service, which sets the service_id. If the se...
I'm a rails and ruby noob, and Im pretty sure this something completely stupid I am missing.. Trying to build a nested form, and have found many examples online, and tried and failed to reproduce the desired result. the "seller" fields are not even displayed, and when I submit form I get: unknown attribute: item models: class...