def In Place Editor and Collection Partials
posted_by :Adkron, :on => September 2nd, 2007
I've noticed a lot of individuals have been having problems with the in_place_editor function and using a collection partial. The problem comes down to an in_place_editor looking for an variable beginning with an @. So here is the quick fix.
The partial function:
<%= render :partial => "item", :collection => @items %>
Inside the Partial:
>%@item = item%< >%= in_place_editor_field :item, 'on_hand' %>
I know it is a bit of a hack, but it is a very quick fix. Happy Coding!
end
def Why Should I 'Test Rails Itself?'
posted_by :Adkron, :on => March 21st, 2007
I was reading Google Groups' Rails Group the other day when I ran into someone talking about why should I test the validates functions. Here is a quote from his email:
For example, what is the point of writing a unit test that simply tests a validate statement in the model? Yes, it's interesting (the first time, at least) that the test works and that, golly-gee, Rails works as advertised, as well, but is there any real use in doing this?
I can imagine a scenario where a I update Rails and suddenly a unit test that tests a Rails validator fails, but I expect the Rails development team would find this before me. Or is that too naive?
I just thought I would post my response for anyone who has the same question. Also, sorry if the format is bad or to quick, but I was trying to hurry when I wrote him the response.
Don't look it as testing Rails. You are testing your model on testing validates. Let's say you write this class:
class Person < ActiveRecord::Base validates_length_of :phone_number, :within => 7..10 ... endSo you write a test:
def test_phone_number_length_incorrect person = Person.new(:phone_number => '123456') person.valid? assert person.errors.invalid?(:phone_number), 'Invalid Phone Number Coming Back as Valid' endI think we would all agree that this test makes sure that a valid phone number passes.
Now not thinking you do a find and replace and replace all 7s with 8s or maybe number with numbers is more likely. So you have:
class Person < ActiveRecord::Base validates_length_of :phone_numbers, :within => 7..10 ... endNow you can place :phone_number => '12' into your database because you are now validating :phone_numbers.
If you have a test you run tests after you completed the find and replace, and this error would be caught right away. That is why you 'test Rails.'
end
def ImThere.com Mobile/Social Networking in RoR
posted_by :Adkron, :on => November 26th, 2006
I may be a little biased since I’m on board with Ramped Media, but if your looking for something to do, and love going out you should check out this mobile integrated site.
There are many features that include sending media to and from the site with your mobile phone.
Take a look because in the future you and everyone you know will be saying, “ ImThere!”