On Mar 23, 8:52 pm, John Merlino <li...@ruby-forum.com> 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 constantize throws an error.
As an aside, seing that much markup in a helper is off-putting(in the
same way that too much logic in a template is awkward), if I were you
i'd shift some of that into a partial

Fred
>               table_str += "\t\t\t\t<td>\n"
>                table_str += link_to "Edit", edit_ +
> params[:action].singularize + _path
>               table_str += "\t\t\t\t</td>\n"
>             end
>           end
>         table_str += "\t\t</tr>\n"
>       end
>     table_str += "\t</tbody>\n"
>   table_str += "</table>\n"
>   table_str.html_safe
>      end
>
> This file is located in helpers/layout_helper
>
> Right now I get error: "wrong constant name user" when trying to display
> the users page.
>
> Or perhaps there's a better way to determine whether you want to have a
> link available for certain views (note this is not role-based user
> authorization but rather some views will be editable and others not
> period regardless of user)?
>
> Thanks for response.
>
> --
> Posted viahttp://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to