Rails autosize plugin gem not working

32 views
Skip to first unread message

Bazley

unread,
Jul 16, 2015, 6:48:18 AM7/16/15
to rubyonra...@googlegroups.com
I'm having some issues getting Jack Moore's autosize plugin working in Rails 4.

When I place the following script in `application.html.erb`, it doesn't work. But when I place it directly in the same view as the text area, it works fine. I thought all files could see the javascript if it was placed in `application.html.erb`?

    <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/autosize.js/1.18.4/jquery.autosize.min.js"></script>

Also, I can't get the gem working. In my gemfile I have `gem 'autosize', '~> 1.1.18.4'`, I've done `bundle install`, `bundle update`, `gem install autosize`, restarted the server, but it doesn't work.

Elizabeth McGurty

unread,
Jul 16, 2015, 11:30:50 AM7/16/15
to rubyonra...@googlegroups.com
Is gem 'autosize', '~> 1.1.18.4' a typo?  I ask because at http://plugins.jquery.com/autosize/ that version is not listed. 
Liz

Hassan Schroeder

unread,
Jul 16, 2015, 1:15:32 PM7/16/15
to rubyonrails-talk
On Thu, Jul 16, 2015 at 3:48 AM, Bazley <197...@gmail.com> wrote:
> I'm having some issues getting Jack Moore's autosize plugin working in Rails
> 4.

Is there a reason you're not following the directions?
[quote]
Install

add gem 'autosize' to your Gemfile (and then run bundle install).

And in your application.js: //= require jquery.autosize
[/quote]

I did that with a fresh Rails 4.2 app and it worked as advertised.

How are you invoking it on your textarea and what *exactly* do you
mean by "doesn't work"? Are there JS errors in the console?

--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Consulting Availability : Silicon Valley or remote
Reply all
Reply to author
Forward
0 new messages