Feeds:
Posts
Comments

Archive for the ‘Ruby on Rails (RoR)’ Category

Assert List

assert boolean
assert_equal expected, actual
assert_raise *args
assert_raises *args, &block
assert_instance_of klass, object
assert_nil object
assert_kind_of klass, object
assert_respond_to object, method
assert_match pattern, string
assert_same expected, actual
assert_operator object1, operator, object2
assert_nothing_raised *args
assert_not_same expected, actual
assert_not_equal expected, actual
assert_not_nil object
assert_no_match regexp, string
assert_throws expected_symbol, &proc
assert_nothing_thrown &proc
assert_in_delta expected_float, actual_float, delta
assert_send send_array
assert_response type
assert_redirected_to options = {}
assert_template expected
assert_recognizes expected_options, path, extras={}
assert_generates expected_path, options, defaults={}, extras = [...]

Read Full Post »

Read Full Post »

Mixin in Rails

Ruby is an object-oriented language.  With all object-oriented languages, the designers had to decide whether or not to support multiple inheritance.  Perl and C++ designers allow for multiple inheritance, Java does not allow for multiple inheritance but does allow for polymorphism through the use of interfaces.  Ruby’s designers opted to not allow multiple inheritance, but to allow [...]

Read Full Post »

1) Create a class and let’s call it
Class CallStoredProcedures
your methods here …….
end
2) Create a class method within it
def self.fetch_db_records(proc_name_with_parameters)
ActiveRecord::Base.connection.execute(proc_name_with_parameters)
end
Then simply call it as
CallStoredProcedures.fetch_db_records(“exec procedure_name ‘args1′, ‘args2′, ‘and so on’ “)
Now you might say, that this will only execute a procedure   what if I want to return records or values from stored procedures. Then I will [...]

Read Full Post »

RJS makes it easy to modify multiple elements on your page in one declarative Ajax response.
RJS is a template type for Rails that allows Rails developers to use Ruby to produce dynamic JavaScript code that will usually be executed in response to an AJAX call.
First, create the view that will be updated by the rjs [...]

Read Full Post »

Older Posts »