Re: [Rails] Re: wrong constant name user error

2011-03-25 Thread Frederick Cheung
On 25 Mar 2011, at 16:47, John Merlino wrote: > Frederick Cheung wrote in post #988949: >> On Mar 23, 8:52pm, John Merlino wrote: >>> >>> >if > params[:controller].singularize.capitalize.constantize.method_defined? > :viewable Why not just controller.respond_to? :viewable ? Fred

Re: [Rails] Re: wrong constant name user error

2011-03-25 Thread Colin Law
On 25 March 2011 16:47, John Merlino wrote: > ... > It works but I dont like that I am checking whether a model has the > method "viewable" just to display a link to a detail view in the table. > Is there a better way to determine if the current controller's table > should contain a view or not?

[Rails] Re: wrong constant name user error

2011-03-25 Thread John Merlino
Frederick Cheung wrote in post #988949: > On Mar 23, 8:52pm, John Merlino wrote: >> >> params[:controller].singularize.constantize.responds_to(:viewable) > > Presumably this is the line throwing the error. If params[:controller] > is users then you'll be calling > constantize on the string user. C

[Rails] Re: wrong constant name user error

2011-03-23 Thread Frederick Cheung
On Mar 23, 8:52 pm, John Merlino wrote: > > params[:controller].singularize.constantize.responds_to(:viewable) Presumably this is the line throwing the error. If params[:controller] is users then you'll be calling constantize on the string user. Constants have to start with a capital letter, so