madebymany / sir-trevor-rails

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

wrong number of arguments (4 for 0) #26

Open kulakowka opened 10 years ago

kulakowka commented 10 years ago

I use manual: https://github.com/madebymany/sir-trevor-rails

My gemfile i add: gem 'sir-trevor-rails', github: 'madebymany/sir-trevor-rails', branch: 'v4'

But i have error:

ArgumentError in Posts#new
Showing .../app/views/posts/_form.html.haml where line #18 raised:

wrong number of arguments (4 for 0)
Extracted source (around line #18):

In _form.html.haml i write:

= form_for @post, url: url_for(@post) do |f| 
   = f.sir_trevor_text_area :body

Model have attribute :body

When has be error ???

P.S. $ rails -v

Rails 4.0.0

sibsfinx commented 10 years ago

I get same error when using f.sir_trevor_text_area in Active Admin

Fudoshiki commented 10 years ago

wrong number of arguments (4 for 0) ruby 2.0 rails 4.0.4

ninjabiscuit commented 10 years ago

Hi guys.

Try this branch of the gem: https://github.com/madebymany/sir-trevor-rails/tree/redesign-gem

There are some changes that you will need to make but in the long run it should make ST integration easier as it removes the need for sir_trevor_text_area. Plus I've been using it with Rails 4 ruby 2 on a number of apps so should work there.

I'm just trying to find the time to write some test before I PR it to master.

Let me know if you have any problems

Fudoshiki commented 10 years ago

gem 'sir_trevor_rails' Could not find gem 'sir_trevor_rails (>= 0) x64-mingw32' in the gems available

gem 'sir_trevor_rails', github: 'madebymany/sir-trevor-rails', branch: 'redesign-gem' work but

rails s C:/Ruby200-x64/lib/ruby/gems/2.0.0/bundler/gems/sir-trevor-rails-0b6fb9a7f458/lib/sir_trevor_rails/view_resolver.rb:2:in `module:SirTrevorRails': uninitialized constant ActionView::FileSystemResolver (NameError)

Fudoshiki commented 10 years ago

can you upload working example with sir trevor on rails?

tomgrim commented 10 years ago

+1

Rails: 4.0.4 Ruby 2.1.1

Can't even try @ninjabiscuit s branch as I get this error:

Could not find gem 'sir-trevor-rails (>= 0) ruby' in https://github.com/madebymany/sir-trevor-rails.git (at redesign-gem).

ninjabiscuit commented 10 years ago

@tomgrim for some (stupid) reason, I renamed the gem to be sir_trevor_rails (note the underscores) for consistency. try it again by referencing the the correct name in the gemfile

tomgrim commented 10 years ago

Ah good catch! Unfortunately I'm now getting:

undefined method 'sir_trevor_text_area' for #<Formtastic::...

I see someone else fixed this by restarting their server but I haven't had the same luck.

ninjabiscuit commented 10 years ago

Yeah, I need to write an upgrade guide for this gem I guess.

I've removed the sir_trevor_text_area helper (as well as a bunch of other helpers too)

Most of the breaking changes are mentioned here: https://github.com/madebymany/sir-trevor-rails/blob/redesign-gem/README.md

to fix that error, you'll need to manually set up a textarea for use with sir trevor. IE use a normal textarea_tag with a class that you can reference from your JS when you instantiate ST.

I'll try and put together a guide at some point.

tomgrim commented 10 years ago

Should really have read the commits before posting but at least it's working now! Thanks a lot for your help :thumbsup:

ninjabiscuit commented 10 years ago

No problem, glad you got it working. You've spurred me on to finish the documentation