kpumuk / meta-tags

Search Engine Optimization (SEO) for Ruby on Rails applications.
MIT License
2.73k stars 275 forks source link

Not working with Rails 3 #3

Closed amoslanka closed 13 years ago

amoslanka commented 13 years ago

I am perhaps missing something, but I can't seem to get the proper output using this plugin with rails 3. I'm including the gem using the Bundler gemfile, and the gem is properly installed after running bundle install. I also get a "true" when running require 'meta_tags' from irb.

It seems though that something is missing because the set_meta_tags method throws an error whenever I attempt to use it, and the the <% title 'Document Title' %> tag in the erb file doesn't throw an error, but doesn't output anything.

Seems like I'm missing something. Is my using bundler to manage this plugin incorrect? It seems to me that the installation instructions on the readme apply only to rails 2.

Thanks in advance

kpumuk commented 13 years ago

Could you show the stack trace for the error you've mentioned?

Also, when you use <% titile %> no output will be produces, instead your title will be saved to display in tag in the header. To display the text and set the <title>, use <%= title "some title" %>.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/amoslanka"><img src="https://avatars.githubusercontent.com/u/294866?v=4" />amoslanka</a> commented <strong> 13 years ago</strong> </div> <div class="markdown-body"> <p>The error I mentioned is a routing error, and the only information available is "undefined method `set_meta_tags' for ApplicationController:Class"</p> <p>As for the title tag, that actually is how I'm using it. There's just nothing output. I've placed </p> <p><code><% title 'Site Name' %></code></p> <p>in the header and</p> <p><code><h1><%= title 'Page Title' %></h1></code></p> <p>in the body and still, no page title is rendered.</p> <p>thanks amos</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/csiszarattila"><img src="https://avatars.githubusercontent.com/u/30090?v=4" />csiszarattila</a> commented <strong> 13 years ago</strong> </div> <div class="markdown-body"> <p>First: Great plugin, thanks!</p> <p>I can also confirm this error: failed to use it with bundler in a rails2 app. However I think its an error on bundler because when I installed as a rails plugin it work like a charm.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/ghost"><img src="https://avatars.githubusercontent.com/u/10137?v=4" />ghost</a> commented <strong> 13 years ago</strong> </div> <div class="markdown-body"> <p>I was able to generate an actual error in Rails 3.05 with <% set_meta_tags :description => ActionView::Template::Error (undefined method `display_meta_tags' for #<#<Class:</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Fedalto"><img src="https://avatars.githubusercontent.com/u/67917?v=4" />Fedalto</a> commented <strong> 13 years ago</strong> </div> <div class="markdown-body"> <p>To fix this in Rails 3, just put in the Gemfile:</p> <pre><code>gem 'meta-tags', :require => 'meta_tags'</code></pre> <p>and then:</p> <pre><code>$ bundle install</code></pre> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/kpumuk"><img src="https://avatars.githubusercontent.com/u/10163?v=4" />kpumuk</a> commented <strong> 13 years ago</strong> </div> <div class="markdown-body"> <p>Added information about bundler to the README</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jspaper"><img src="https://avatars.githubusercontent.com/u/830424?v=4" />jspaper</a> commented <strong> 12 years ago</strong> </div> <div class="markdown-body"> <p>@Fedelto, I did as you say, development is fine but production will show undefined display_meta_tags or undefined title method. </p> <ul> <li>Ruby 1.9.3-p125</li> <li>Rails 3.2.3</li> <li>meta-tags 1.2.6</li> </ul> <p>thanks.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jamonholmgren"><img src="https://avatars.githubusercontent.com/u/1479215?v=4" />jamonholmgren</a> commented <strong> 12 years ago</strong> </div> <div class="markdown-body"> <p>Having this same problem with Rails 3.2.6, Ruby 1.9.3-p125, meta-tags 1.2.6.</p> <pre><code>undefined method `title' for #<#<Class:0x007fde87924420>:0x007fde878a7f88></code></pre> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/wspruijt"><img src="https://avatars.githubusercontent.com/u/125226?v=4" />wspruijt</a> commented <strong> 12 years ago</strong> </div> <div class="markdown-body"> <p>Same issue here:</p> <pre><code>undefined method `set_meta_tags' for ApplicationController:Class</code></pre> <p>ruby 1.9.3p125 rails 3.2.3 meta-tags 1.2.6</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/vijaybrr"><img src="https://avatars.githubusercontent.com/u/2083276?v=4" />vijaybrr</a> commented <strong> 11 years ago</strong> </div> <div class="markdown-body"> <p>I am also seeing this issue in production, but works fine in development. </p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Stratus3D"><img src="https://avatars.githubusercontent.com/u/1520926?v=4" />Stratus3D</a> commented <strong> 11 years ago</strong> </div> <div class="markdown-body"> <p>I am having the same issue as well.</p> <p>My environment: ruby 2.0.0p247 rails 3.2.14 meta-tags 1.5.0</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/demirhanaydin"><img src="https://avatars.githubusercontent.com/u/281380?v=4" />demirhanaydin</a> commented <strong> 10 years ago</strong> </div> <div class="markdown-body"> <p>If you're using unicorn, maybe restarting unicorn after deploy can solve your require problem.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/midoru0121"><img src="https://avatars.githubusercontent.com/u/3450879?v=4" />midoru0121</a> commented <strong> 8 years ago</strong> </div> <div class="markdown-body"> <p>@demirhanaydin Thanks. Restarting unicorn solved the problem.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/manvedu"><img src="https://avatars.githubusercontent.com/u/11188064?v=4" />manvedu</a> commented <strong> 5 years ago</strong> </div> <div class="markdown-body"> <p>I have the same problem, undefined method `set_meta_tags' for ApplicationController:Class and Im in development enviroment. ruby '2.5.1' and 'rails', '~> 5.0.1'</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>