I just pushed a large set of changes to the master branch of Hobo on
github.   There are a couple of good reasons why now would be a good
time to update your app to test your application against them.

- we're now code complete for the next release.

- for one of the major changes I made, the old code is still in the
repository.   Right now object_url runs both the old code and the new
code and fails if they emit different results.   The old code will be
removed before release, so failures will be much less obvious and
harder to track down.

test your code with config.hobo.dont_emit_deprecated_routes = true and
false.  The old code comparison mentioned above cannot be run with it
set to true, and the named_route changes will not be emitted with it
set to false (or not set at all).

I'll release gems in a couple of days, but it would be nice if a
couple of more experienced Hoboists can test this before I do so.

Here's the snippet from CHANGES:


## default controller actions now use respond_with

All Hobo model controller actions now use
[respond_with](http://apidock.com/rails/ActionController/MimeResponds/respond_with)
where appropriate.   This means that you can create an API interface
for a controller simply by adding:

    respond_to :html, :json, :xml

See 
[respond_to](http://apidock.com/rails/ActionController/MimeResponds/ClassMethods/respond_to)
and Google for "respond_with" for more information.


## named routes' names changed to use standard Rails names

The names of named routes generated by Hobo have changed to more
closely match the default names generated by the Rails REST route
generator. The standard 7 REST routes have not changed, but some
additional routes such as nested routes and lifecycle routes have been
renamed.

For the moment you can ask Hobo to emit both the new style and old
style routes by not defining
`config.hobo.dont_emit_deprecated_routes`.

Note that paths and method names have not changed, only the named
route has changed, so this change should not be visible to the user or
impact controller code.

The route name is leftmost column in `rake routes`.

Here are some example changes:

    create_task_path           => create_tasks_path       # tasks#create
    create_task_for_story_path => create_story_tasks_path #
tasks#create_for_story
    foo_transition_path        => transition_foo_path     # foos
lifecycle transition
    foo_show2_path             => show2_foo_path          #
show_action :show2 in foos_controller

Note that in the second example, create_story_tasks_path, the
controller method name is `create_for_story`. This is the same method
name that Hobo 1.0 and 1.3 use; the default Rails method name would be
just plain `create`.

There are several named routes used in the user_mailer views generated
in a new application. These must be fixed up when upgrading an old
application. For instance, user_activate_url must be changed to
activate_user_url in activation.erb.

In exchange for the pain of updating some of your named routes, we
receive the following benefits:

- polymorphic_url works with nested routes and in more situations

- url_for will work in more situations

- the `<a>` tag and the many tags which use it now accept all the
  `url_for` options, such as host and port.

- hobo_routes.rb is easier to read and understand

- code reduction in Hobo


The changelog may also be worth looking at:

https://github.com/tablatom/hobo/commits/master/

Bryan

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to