bartlomiejdanek / best_in_place_mongoid

A RESTful unobtrusive jQuery Inplace-Editor and a helper as a Rails Gem
http://blog.bernatfarrero.com/in-place-editing-with-javascript-jquery-and-rails-3/
16 stars 7 forks source link

Support for Mongoid 2.4.X #3

Open hayksaakian opened 11 years ago

hayksaakian commented 11 years ago

given that they're on 3.x now, supporting to most up-to-date minor version would be nice

this specifically conflicts with the will_paginate_mongoid gem, which DOES support 2.4.2

bartlomiejdanek commented 11 years ago

Okay, can you test it anyway? Just add to your Gemfile line

gem 'best_in_place_mongoid', github: 'bartekd/best_in_place_mongoid', branch: 'mongoid_2_4_2'

Let me know is it work.

hayksaakian commented 11 years ago

I'll try it in the morning (8-10 he's from now), thanks for being quick to respond :-)

hayksaakian commented 11 years ago

bundle worked without complaining, but now i cant seem to follow the install instructions. Here's what I did:

add gem 'best_in_place_mongoid', github: 'bartekd/best_in_place_mongoid', branch: 'mongoid_2_4_2' to gemfile

bundle

try to do rails g best_in_place:setup but this fails because 'Could not find generator best_in_place:steup.'

do i need to add the normal 'best_in_place' gem too?


whoops, typo. trying again now. -- Nope still didnt work

bartlomiejdanek commented 11 years ago

How did you install a new gem version?

hayksaakian commented 11 years ago

at first i did a regular bundle install, i also tried a bundle update

my gemfile:

source 'https://rubygems.org'

gem 'rails', '3.1.0'

gem "mongoid", "~> 2.4.0" gem "bson_ext", "1.6.2" gem "mongo" gem 'mongoid_fulltext', "~> 0.5" gem "will_paginate_mongoid", "~> 1.0.0" gem "will_paginate", "~> 3.0.3" gem 'bootstrap-will_paginate'

gem "delayed_job", "~> 3.0.2" gem "delayed_job_mongoid", "~> 1.0.8" gem "foreman"

gem 'twilio-ruby'

gem "therubyracer" gem "less-rails" gem "twitter-bootstrap-rails", "~> 2.1.2"

gem 'best_in_place_mongoid', github: 'bartekd/best_in_place_mongoid', branch: 'mongoid_2_4_2' gem 'best_in_place'

gem 'fullcontact'

Gems used only for assets and not required

in production environments by default.

group :assets do gem 'sass-rails', '~> 3.1.0' gem 'coffee-rails', '~> 3.1.0'

gem 'uglifier', '>= 1.0.3' end group :development do gem 'binding_of_caller' gem "better_errors" end gem 'jquery-rails'

gem "heroku"

bartlomiejdanek commented 11 years ago

You cannot use both best_in_place gems..

gem 'best_in_place_mongoid', github: 'bartekd/best_in_place_mongoid', branch: 'mongoid_2_4_2'
# gem 'best_in_place' # <- remove this line

second thing try setup best in place by bundle exec rails g best_in_place:setup

hayksaakian commented 11 years ago

let me make that change now. the install instructions on the readme told me to add gem best_in_place to the gemfile though

same problem with using bundle exec as normal 'Could not find generator best_in_place:setup.'

bartlomiejdanek commented 11 years ago

Eh the readme doesn't tell the truth.. looks like the generator has been removed from main repository (best_in_place). Installation process is easy, you have to just add

//= require best_in_place.purr

into your application.js

Then it should work out of the box.

hayksaakian commented 11 years ago

ok, i added //= require best_in_place (the .purr version was causing errors: 'couldn't find file 'best_in_place.purr' ') but now it just won't work, for example: <%= best_in_place @lead, :first_name, :nil => "Click here to add one" %> which turns into

<span class="best_in_place" id="best_in_place_lead_50b7f02d2efc122126000008_first_name" data-url="/leads/50b7f02d2efc122126000008" data-object="lead" data-attribute="first_name" data-nil="Click here to add one" data-type="input">abnother</span>

for example, but this behaves like a normal span, and is not editable


my application.js, for reference //= require jquery //= require jquery_ujs //= require twitter/bootstrap //= require bootstrap //= require best_in_place //= require_tree .

bartlomiejdanek commented 11 years ago

Thanks! I'm going to fix it tomorrow.

hayksaakian commented 11 years ago

thanks

hayksaakian commented 11 years ago

any success? :)

bartlomiejdanek commented 11 years ago

I'm still working on best solution... give me more time (it should be ready in saturday).

hayksaakian commented 11 years ago

if this is too time consuming / difficult, are there alternatives you can suggest in the mean time?

hayksaakian commented 9 years ago

any news on this?