Running specific migrations
rake db:migrate:redo VERSION=20140430171821
cherry valley forever
Monterey Bay Aquarium
Peter Solarz

No title available

Andulka
noise dept.

if i look back, i am lost
Lint Roller? I Barely Know Her
Jules of Nature
Misplaced Lens Cap
Claire Keane

⁂

★
Stranger Things
official daine visual archive
sheepfilms

ellievsbear
🪼
d e v o n
wallacepolsom
seen from United States

seen from Malaysia
seen from United States
seen from Türkiye

seen from United States

seen from Nepal

seen from Malaysia
seen from United States

seen from United States
seen from United States
seen from Hungary

seen from Romania
seen from United States

seen from Malaysia
seen from Malaysia
seen from Spain

seen from South Africa

seen from United States
seen from United States
seen from United States
@fatmodelsblog-blog
Running specific migrations
rake db:migrate:redo VERSION=20140430171821
HABTM Class
If you ever need to work directly with a HABTM relation table, you can simply create a model which inherits from active record to interact with the data:
If your table is named agents_clients, create a class called AgentsClients:
class AgentsClients < ActiveRecord::Base end
Now you can do things like:
ac = AgentsClients.first
I used this when I was migrating an existing HABTM relation to a has_many :through model. It was useful to be able to grab all the data and move it to my new :through model.
rake mongo:restore
rake mongo:restore LOCAL=/absolute/path/to/<backup-file.gz>
Drop Table via Active Record
ActiveRecord::Migration.drop_table :table_name
ActiveRecord::Migration.add_column :table_name, :length, :integer, default: 2
Track Branch
git branch --set-upstream mobile-new origin/mobile-new
Reset Auto Increment
def self.reset_auto_num
ActiveRecord::Base.connection.execute( "alter table [table] auto_increment 1 " )
end
Delete GIT Branch
git push REMOTENAME :BRANCHNAME
ex: git push origin :newcrops
Git Branch
[from master] git branch staging
git checkout staging
Switched to branch 'staging'
git push origin staging:refs/heads/staging
New Rails app with MySQL
rails new [project_name] -d mysql
Collect
User.find(:all, :conditions => "hitfix = 1").collect(&:id)
Helpers within Controllers
You can use @template.[helper] within a controller to use it! COOL!
@template.strip_tags(event.description),
Run a specific migration
rake db:migrate:up VERSION=20120113194623
Creating a migration in rails 2.1
ruby script/generate migration ‘name’
Installing a gem within my RVM environment
rvm 1.8.7@rails211 do gem install AjaxfulRating --no-rdoc --no-ri
Console on EY SSH (from the current directory)
ey_bundler_binstubs/rails c
Load a SQL file to a table
msyql -u root hitfix2 -p < thefilename.sql