please test your apps against github master

43 views
Skip to first unread message

Bryan Larsen

unread,
Sep 6, 2012, 3:08:00 PM9/6/12
to Hobo Users
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

kevinpfromnm

unread,
Sep 7, 2012, 7:14:18 PM9/7/12
to hobo...@googlegroups.com
Do we have a list of required/recommended changes to handle 1.4 somewhere?

nevermind, found it. http://cookbook-1.4.hobocentral.net/manual/changes14

Bryan Larsen

unread,
Sep 8, 2012, 3:03:14 PM9/8/12
to hobo...@googlegroups.com
What version of Hobo did you use to generate that app? I just tried
with 1.4.0.pre8, then switched to github master, and was able to
create the administrative account without problem.

Of course, if you're generating a new app, you're in general better
off generating with the version you intend to use, but what you tried
should work.

Could you send me the full error message and backtrace produced by
that line of code?

thanks,
Bryan


On Fri, Sep 7, 2012 at 7:46 PM, Mason <*@chipped.net> wrote:
> Just created a new app, mo changes (other than pointing it at git master),
> and on the first attempt to register the administer account I get this:
>
> ~/.rvm/gems/ruby-1.9.3-p194@global/bundler/gems/hobo-713bb0c2cdc6/hobo/app/helpers/hobo_route_helper.rb:9
> raise Hobo::Error.new("new style url #{new_} does not match old style url
> #{old_}. obj: #{obj.inspect}. args: #{args.inspect}. backtrace:
> #{caller.inspect}") if old_ != new_
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/F0t9lMmbZYYJ.
>
> To post to this group, send email to hobo...@googlegroups.com.
> To unsubscribe from this group, send email to
> hobousers+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hobousers?hl=en.
Reply all
Reply to author
Forward
0 new messages