[Rails] Re: How to save double-byte characters in mongodb?

2015-07-19 Thread Matt Jones


On Thursday, 9 July 2015 04:47:00 UTC-4, Kiran Kumar wrote:
>
> I have a Model called *Review.rb*
>
> class MovieNews::Review
> include Mongoid::Document
> include Mongoid::Timestamps
> include Mongoid::Userstamp
> include Mongoid::Search
>
> field :story,   type: Stringend
>
>
> When i create a instance of class review and tried saving which local 
> language telugu in the field, im getting wrong output.
>
> Ex1:
>
> review = MovieNews::Review.new
> review.story = "నటవర్గం" after pasting here it's spelling goes worng "నటవర్.."
> review.save => true
>
> Does Mongodb supports local languages to create collection? Someone please 
> help me out.
>
> As Fred has indicated, is the issue that the string appears incorrectly in 
the terminal / editor, or that it is saved incorrectly to the database? I 
was able to produce a string that looks (to my 
thoroughly-unfamiliar-with-Telegu-script eyes) like your "spelling goes 
wrong" example by replacing the last six bytes of the string with two 
literal periods (codepoint U+2E).

--Matt Jones

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/f9c5665f-c59d-488a-8e67-2582520fbd8c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Deleting only first occurrence from many to many collection

2015-07-19 Thread Sadaf Noor
Hello,
I am having a little bit problem in deleting duplicate entry of my many to
many tables.

In many to many fields delete method is deleting all the occurrence of
collection. Say I have (demo example):

class user < ActiveRecord::Base
  has_and_belongs_to_many :cars
end

class car < ActiveRecord::Base
  has_and_belongs_to_many :users
end

users and cars are many to many relationship, I have defined my
users_cars table.
Now user can have repetitive car entry as relation. For example:

Car: A,B,C User: U1,U2,U3

U1=[A,B,C,A,A,A,B]

Which can be implemented using many to many relationship, the way I have
implemented. BUT, at the time when I want to delete one of the car entries
of user the problem occurs.

Users.cars.delete(car) #deletes all occurrence of car
Users.cars.delete_at(User.cars.find_index(video_card)) #delete_at does not exist

Now how to resolve this?

I have also posted at stackoverslow (
http://stackoverflow.com/questions/31507056/deleting-first-occurrence-from-many-to-many-collection-entry-at-rails).
Please feel free to answer, and/or upvote.


Thanks.
-- 
  Md. Sadaf Noor (@sadaf2605 )
 www.sadafnoor.com

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAAJ2eVrRTfxTbV%2BKr-dOwMPon-Q1%2BhCvTWu9e4cLJxv%2BwsN5Rw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Learning Devise for Rails

2015-07-19 Thread Greg Bressler
Thanks for the help, everyone.  After following the link to github that 
Elizabeth posted I was able to cut and paste some updated code.

Thanks again.

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/4ebcc844bf71eac2c6e62bbd77d322ba%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.