madebymany / sir-trevor-rails

Rails gem for Sir Trevor integration.
MIT License
149 stars 50 forks source link

ActionView::Template::Error in production with Rails 4 #20

Open OlegPasko opened 10 years ago

OlegPasko commented 10 years ago

Using sir-trevor-rails with fix by @maxmcd (https://github.com/maxmcd/sir-trevor-rails). Working well in development, but in production I have

ActionView::Template::Error (undefined method `sir_trevor_text_area' for #<ActionView::Helpers::FormBuilder:0x000000041c7858>):
44:     </div>
45:     <div class="form-group">
46:       <%= f.label :content %>
47:       <%= f.sir_trevor_text_area :content, rows: 10, class: 'form-control' %>
48:     </div>
49:     <div class="form-group">
50:       <%= f.label :tag_list %>
  app/views/posts/_form.html.erb:47:in `block in _app_views_posts__form_html_erb___2074943611839989041_30498540'
  app/views/posts/_form.html.erb:1:in `_app_views_posts__form_html_erb___2074943611839989041_30498540'
  app/views/posts/new.html.erb:9:in `_app_views_posts_new_html_erb___4056126361373820737_32457920'

What can I miss?

maxmcd commented 10 years ago

My fix is pretty hacky. Hopefully someone from the madebymany team will come along and clean it up. I'm not specifically sure what's wrong with your code, everything's working for me in production. One correction though: <%= f.sir_trevor_text_area :json_body, input_html: {} %> This is how you add html addtributes. So for you it would be: <%= f.sir_trevor_text_area :content, input_html: {rows: 10, class: 'form-control'} %> You also really don't need the rows and class attributes though as sir-trevor hides the textarea.

edit: also, let me know if you're just using the pull request, or my fork, they are slightly different, I can only confirm that my comments work for my fork

OlegPasko commented 10 years ago

Oops, html is atavism from text_input. I'm using your fork. Maybe it is another problem... I'm using gem without require 'sir-trevor-rails' in application controller, it works nice in development. When I use require, it is an error with Unicorn in production appears.

Thanks.

OlegPasko commented 10 years ago

It is problem in Unicorn. I just needed to stop and start (not restart) server :)

OlegPasko commented 10 years ago

Some offtop... @maxmcd, why are you skip Gallery functionality https://github.com/madebymany/sir-trevor-rails/blob/master/app/assets/javascript/sir-trevor/sir-trevor.js#L1083 ? :)

maxmcd commented 10 years ago

@OlegPasko That's from an older version of sir-trevor.js, it looks like they were planning on including galleries and then dropped the functionality. The newest version of the library doesn't have any reference to galleries.