Quantcast
Channel: Frank Sun » RubyOnRails
Browsing latest articles
Browse All 17 View Live

Rails has_many :through Find by Extra Attributes in Join Model

a good post from : http://stackoverflow.com/questions/408872/rails-has-many-through-find-by-extra-attributes-in-join-model New to both Ruby and Rails but I’m book educated by now (which apparently...

View Article



Rails: Controller Helper_method

helper_method is useful when the functionality is something that’s used between both the controller and the view. A good example is something like current_user. If the method deals more with controller...

View Article

Rails validate uniqueness of multiple columns?

Is there a rails-way way to validate that an actual record is unique and not just a column? For example, a friendship model / table should not be able to have multiple identical records like: user_id:...

View Article

Image may be NSFW.
Clik here to view.

How to Install Command Line Tools In OSX 10.9 Mavericks

from: http://www.computersnyou.com/2025/2013/06/install-command-line-tools-in-osx-10-9-mavericks-how-to/   Installing command line tools in OSX 10.9 Mavericks changes slightly than previous versions of...

View Article

Rails: Could not find a JavaScript runtime.

I could not find a JavaScript runtime. See sstephenson/ExecJS (GitHub) for a list of available runtimes (ExecJS::RuntimeUnavailable). Solution: In your Gem file, write gem 'execjs' gem 'therubyracer'...

View Article


Image may be NSFW.
Clik here to view.

Ruby on Rails FAQ

from: http://momosuyu.iteye.com/blog/2033980 1 ruby是什么? Ruby,一种为简单快捷面向对象编程而创的脚本语言,它综合了Perl,Python,Java等语言的特 点写成,有强大的文字处理能力,简单的语法,并且完全的面向对象。同时,Ruby是解释型语言,不需编译即可快捷地编程。Ruby由日本的 Yukihiro...

View Article

Rails Transactions

Question: I have an example Action in a Controller. def some_action product =Product.new product.name ="namepro"if product.save client.update_attribute(:product_id,product.id)endend How to add...

View Article

Auditing and model lifecycle management for instances and their associations?

from: http://stackoverflow.com/questions/1615977/auditing-and-model-lifecycle-management-for-instances-and-their-associations   CRUD operations must be logged, including what the operation was, who the...

View Article


Rails practice: use after_commit

A relational database, like mysql, provides transactions to wrap several operations in one unit, make them all pass or all fail. All isolation levels except READ UNCOMMITTED don’t allow read data...

View Article


Different Ways to Set Attributes in ActiveRec

Rails 4 allows the developer to change ActiveRecord attributes in various ways. Each one does it slightly differently with sometimes unique side-effects. It’s important you understand which method to...

View Article
Browsing latest articles
Browse All 17 View Live




Latest Images