[Rails] Re: Relational DB - Related and not Related

2013-06-24 Thread Cameron Gilroy
Thanks Dave & Colin! That was how I had hoped it would work!

On Monday, June 24, 2013 10:54:14 PM UTC+10, Cameron Gilroy wrote:
>
> Hi
>
> I'm working on a project that has users and groups, users can be members 
> of a group *or* they can just be a user - what's going to be the best way 
> to deal with this?
> I understand the normal has_many relationship just not sure how to do this 
> one. Will try to post some code snippets tomorrow.
>
> Thanks, Cameron
>

-- 
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/0f7b85cd-37e2-417b-8f50-35f3f5ec53b5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: ActiveRecord::Base.transaction - SystemStackError - stack level too deep:

2013-06-24 Thread Bob O
Thanks Matt. That was the problem. At one point I had pulled those out, or 
at least I thought I did. I guess thats why I was confused. Anyway. Thanks 
For the help. I do have Michaels stuff. Its very good. My setters were a 
rookie mistake. 

One thing that I wish i could find more stuff about is transactions. Most 
examples seem to handle the transactions in the controller which I dont 
like. So I have troubles getting the errors back to the controller for 
better user feedback. Hence the reason I was trying to use the 
TransactionAttributes module. Backfire!

Appreciate your help.

Bob

On Saturday, June 22, 2013 5:06:54 PM UTC-6, Bob O wrote:
>
> Im having an issue that seems to only happen when trying to use a 
> transaction. Ive used transactions many times in the past and Im at a loss 
> as to why im getting the stack level too deep problem.
>
> SystemStackError - stack level too deep:
>   actionpack (3.2.13) lib/action_dispatch/middleware/reloader.rb:70:in `'
>
> I have a StackOveflow with more detail - 
> http://stackoverflow.com/q/16930511/1408461
>
> As stated in the SO. If I try to save the record to the database outside 
> the transaction it saves just fine. I only get the error in the 
> transaction. 
>
> Params Object
>
> params => {
>   "resource"=> {
> "resource_type"=>"document", 
> "resource_name"=>"My Rails Doc",
> "source_id"=>"Dropbox"
>   },
>   "resource_document"=> {
> "resource_document"=> 
> #   @content_type="text/plain",
>   @headers= "Content-Disposition: 
> form-data; name=\"resource_document[resource_document]\";
> filename=\"rails_local_env_setup.txt\"\r\n
> Content-Type: text/plain\r\n",
>   @original_filename="rails_local_env_setup.txt",
>   @tempfile= 
> #>},
>
>   "action"=>"create",
>   "controller"=>"resources"
>  }
>
> **Controller**
>
> def create
>
>   if current_teacher
> @resource = ResourceObject.create_teacher_resource(params, 
> current_teacher)
>   end
>
>   if current_student
> @resource = ResourceObject.create_student_resource(params, 
> current_student)
>   end
>
>   if current_admin
> @resource = Resource.new(params[:resource])
>   end
>
>   respond_to do |format|
> if @resource.success
>   format.html { redirect_to @resource, notice: 'Resource was successfully 
> created.' }
>   format.json { render json: @resource, status: :created, location: 
> @resource }
> else
>   format.html { render action: "new" }
>   format.json { render json: @resource.errors, status: 
> :unprocessable_entity }
> end
>   endend
>
> **Transaction**
>
> class ResourceObject
>
>   def self.create_teacher_resource(params, teacher)
> begin
>   ActiveRecord::Base.transaction do
> # Create Resource
> @resource = Resource.new
> @resource.resource_name = params[:resource][:resource_name]
> @resource.resource_type = params[:resource][:resource_type]
> @resource.source_id = params[:resource][:source_id]
> @resource.teacher_id = teacher.id
> @resource.save
>
> # Create Resource Document
> @resource_document = ResourceDocument.new
> @resource_document.resource_document = 
> params[:resource_document][:resource_document]
> @resource_document.resource_id = @resource.id
> @resource_document.save
>
> # TODO Add Commom Core Joins
> # TODO Video Uploader
> # TODO Image Uploader
>
> return @resource.success = "ok"
>   end
> rescue Exception => e
>   # TODO Need to figure out how to pass exception message back to 
> controller
>   return @resource.errors
> end 
>   end
> end
>
> end
>
> Resource Model
>
> class Resource < ActiveRecord::Base include TransactionAttributes 
> attr_accessible :resource_name, :resource_type, :source_id, :teacher_id, 
> :student_id, :success, :errors belongs_to :teacher, :class_name => 
> "Teacher", :foreign_key => "teacher_id" belongs_to :student, :class_name => 
> "Student", :foreign_key => "student_id" has_many :resource_documents # 
> has_many :resource_images # has_many :resource_videos # has_many 
> :question_resources # has_many :assignment_resources end
>
>

-- 
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/4091818b-58f6-4af1-858c-0c8fd272e87e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: How to send a cookie without having it CGI escaped

2013-06-24 Thread anywho
I ended up using

headers['Set-Cookie'] = 'cookiename=key=value@key2=value2; 
domain=.domain.com; path=/'

-- 
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/3f799eea-da15-45d4-95be-30cdc97a6fc6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] How to send a cookie without having it CGI escaped

2013-06-24 Thread anywho
hi,

I'm trying to get a cookie to store in the format  key=value@key2=value2  ( 
compatibility reasons over which I have no control ).

However, when the cookie get's set, it is stored as 
key%3Avalue%40key2%3Avalue2 which is what the CGI.escaped version 
of key=value@key2=value2 looks like.

How can I set it without it being escaped?

Thanks in advance,

-a


-- 
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/dc779552-ff65-4a2c-a095-b33bd7214ed5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] [JOBS] Jr. & Sr. RoR Developers—San Francisco and LA—$130-170K

2013-06-24 Thread liz
I'm working a group of Bay Area companies with fun company culture and 
great compensation—Chartboost, Everlane and Triggit. 

Chartboost is based in downtown SF and just raised $19 million in funding 
from Sequoia Capital. They want a Sr. Ruby Developer to join their small 
team of engineers—guys that are sports enthusiasts  rock climbers, comic 
book readers, and then some. 

Since the team is small, you'll have a lot of responsibility in a 
close-knit group of engineers and will learn something new almost every 
day. 

Salary is market rate—anywhere between $135-170K based on experience with 
bonus and benefits. You can also expect perks such as 20 days PTO, free 
dinner every night, and champagne Fridays (Because the fact that it's 
Friday is reason enough to celebrate!) 

Chartboost is the world's largest games only technology platform.  If they 
don't get you going, we also have Jr. RoR positions with buzz worthy 
e-commerce company Everlane in SF and LA, and Facebook marketing company 
Triggit in SF. 

*Here's a recent article about Charboost: *
http://techcrunch.com/2013/04/23/chartboost-europe/ 

Contact me at l...@neohire.com for more details. 

-- 
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/b49c0de8-290c-483b-8b33-af6d55b347f3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Rails 3 application capable of generating an offline version of itself for download as zip archive

2013-06-24 Thread Paul
It sounds like you might want to implement an offline app instead. There is
browser support in most browsers for appcache to make all your assets
available offline, and there is the javascript call navigator.onLine that
will tell you if you are offline or not. You'll have to create and maintain
an appcache file. There is a gem that handles that, but I ended up just
creating an appcache controller and serving it myself.

This is quite a fundamental architecture change, though, so you might be
too far along in development to do it. You could create a small sample app
to prove the concept, then drag all your existing code into it.

See http://railscasts.com/episodes/247-offline-apps-part-1 for an
introduction.



On Mon, Jun 17, 2013 at 11:32 PM, Tamara Temple wrote:

> Hernán Lucas P.  wrote:
> > I'm kinda newbie in RoR yet and I'm having a hard time trying to figure
> > out how should I implement this. I'm writing an application to store and
> > display information about insects and their distribution. Currently I
> > have almost all functionality implemented, except for a **very**
> > important one: The application must be capable of "crawling" itself and
> > generate a zip archive for download. Actually, crawling itself isn't
> > accurate enough, since the views must be sightly different (e.g. don't
> > provide functionality not available without Internet connection,
> > indicate in the title that the page is an offline copy, etc).
> >
> > The question is: Do you have any suggestions as to how I should
> > implement this?
>
> My suggestion is I hope simple. Use wget to crawl/mirror the site, using
> a query string parameter to indicate you want the "offline" views -- you
> still need to implement them if they are different enough -- by checking
> that the special parameter is set; you should be able to set it just
> once for the session, and have wget use cookies to maintain the session
> info.
>
> Another alternative instead of the query string parm could be using the
> user agent string wget sends, and always deliver the "offline" version
> to that UA string.
>
> The mirroring will pull all the urls that are included under the main
> one. If your assets are not under that main url, this won't work. You
> can tell wget to pull from elsewhere, but it can easily get out of
> hand.
>
> Hope this helps.
>
> --
> 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/51bfd4c9.a870320a.0dab.5746%40mx.google.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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/CABceSpAiw3sH7cdisBZdoy%3Dg5-_G1cOJbVE0u0P258W-bF3UGA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] ruby pack unexpected results

2013-06-24 Thread Colin Law
On 24 June 2013 20:59, Colin Law  wrote:
> On 24 June 2013 17:49, John Merlino  wrote:
>> I have two hex values and expect back the value "3007"
>>
>>
>> What pack does is take the array of hexes and formats them into a string (if
>> ASCII representation, then ASCII character, otherwise the raw hex as
>> string). Then I take the string of hexes and unpack them, that is, get the
>> unsigned int representation of those bytes:
>> [0xBF, 0xB].pack('C*').unpack('I')[0]
>>
>> So I expect back 3007, but the above produces nil.
>
> Do the operation one step at a time in irb and you will see where it goes 
> wrong.

Hint: unpack('I') appears to expect four bytes.

Colin

>
> Colin

-- 
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/CAL%3D0gLsDYXq%3D6PrentSRX9Z4QWH3jSvypmurgmYhRoBeJvNUHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] ruby pack unexpected results

2013-06-24 Thread Colin Law
On 24 June 2013 17:49, John Merlino  wrote:
> I have two hex values and expect back the value "3007"
>
>
> What pack does is take the array of hexes and formats them into a string (if
> ASCII representation, then ASCII character, otherwise the raw hex as
> string). Then I take the string of hexes and unpack them, that is, get the
> unsigned int representation of those bytes:
> [0xBF, 0xB].pack('C*').unpack('I')[0]
>
> So I expect back 3007, but the above produces nil.

Do the operation one step at a time in irb and you will see where it goes wrong.

Colin

-- 
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/CAL%3D0gLtoU7D%3DsP9MC%3DHgemwkmUeospCjTJwWR7SU%2BMsmY6%3D3oA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] [HELP] Couldn't find Search with id= from controller

2013-06-24 Thread cornelius wilson
I have been working on the search form for my app. The advanced search
works fine, however I am unable to get the regular search form to work.
It should be able to search the entire user database, and I should be
able to string keywords together. For example if I search the term "no
kids" it should return the results for everyone who has "no kids" listed
on their profile. Then if I want to be more advance I can search "no
kids, asian" and this would of course pull up users with Asian ethnicity
that has no kids.

When I do this I get the following error: Couldn't find Search with
id=kids. It points to the searches controller for the following line:

def index
@search = Search.find(params[:search])

Also a quick note I am following the railscast 111 for this.

Attachments:
http://www.ruby-forum.com/attachment/8535/searches_controller.rb
http://www.ruby-forum.com/attachment/8536/user.rb
http://www.ruby-forum.com/attachment/8537/search.rb


-- 
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/fa510b2ee367a0502b5a8c250b3298c2%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] wrong number of arguments calling `request` (0 for 1) (ArgumentError)

2013-06-24 Thread ROR Architect
Here is the scenario

  Scenario: Successful login
Given an unauthenticated visitor

When visitor goes to /users/login
And fills in Email with: amitpandya
And fills in Password with: amitpandya
And clicks the Login button

Then amitpandya should be logged in
And page should include a notice with text: Welcome amitpandya
And amitpandya should see the home mypage page

now in steps file

When "$person logs in" do |user|
  post_via_redirect "/users/login", {:authenticator => {:username => user, 
:password => "washington"}},{:https => 'on'}
  request.should_not be_ssl
  request.session[:user_id].should == Person.find_by_username(user).id
end

working fine with cucumber-0.10.0 and cucumber-rails-0.3.2 but if I upgrade 
with cucumber-rails-1.2.1 or cucumber-rails-1.3.1 - at this line 
request.session[:user_id].should == Person.find_by_username(user).id

I am getting bellow error.

Then amitpandya should be logged in# 
features/step_definitions/session_steps.rb:11
 wrong number of arguments calling `request` (0 for 1) (ArgumentError)
 ./features/step_definitions/session_steps.rb:12:in `/^(.*)\ should\ be\ 
logged\ in$/'
 features/login.feature:23:in `Then amitpandya should be logged in'

Any help How can I fix it?


Thank you.

With kind regards,
Amit Pandya

-- 
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/26ea9e72-d04e-40f3-9dd8-06d3b144adb8%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: ActiveRecord::Base.transaction - SystemStackError - stack level too deep:

2013-06-24 Thread Matt Jones


On Sunday, 23 June 2013 20:22:26 UTC-7, Bob O wrote:
>
> This is the TransactionAttributes
>
> module TransactionAttributes
>
>   def success
> success
>   end
>
>   def success=(success)
> self.success = success
>   end
>

That's the problem right there - this method is calling itself. If you want 
to define a getter / setter, you should either do this:

def success
  @success
end

def success=(value)
  @success = value
end

---
Or this (preferred, if you're just storing a value, as above):

attr_accessor :success

 

>   def errors
>   errors
>   end
>
>   def errors=(errors)
>   self.errors = errors
>   end
> end
>

These will break some things - ActiveRecord already defines an `errors` 
method + `errors=` assignment operator, and expects them to behave in a 
particular way (for instance, the validations assume that you can make 
calls like `some_model.errors.add(:some_attribute, 'message')`).

I highly recommend reading through the guides 
(http://guides.rubyonrails.org/) or following some of Michael Hartl's 
excellent tutorial (http://ruby.railstutorial.org/) in preference to 
digging through Stack Overflow - the answers there are incredibly useful if 
you've got a highly specific problem, but they can sometimes miss the 
bigger picture.

Hope this helps,

--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/d64093f3-4bb5-4d4c-b02c-af2c1018a196%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Ruby On Rails integrate with Object C

2013-06-24 Thread haxuan lac
I have some information about handleOpenURL with IOS<4.2 for delegate 
file

and applicationpenURL:sourceApplication:annotation with IOS >=4.3

I don't konw how to use this method in ROR

someone can solve for me this question ,please

Thanks

-- 
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/297e83e5fe7ed3ae4f72955a595943df%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Installing gems to user directory - Configurations - How to ?

2013-06-24 Thread Robert Walker
Boopathi Rajaa wrote in post #1113443:
> I compiled Ruby from source, and installed it to /opt/ruby/ .
> The purpose is to have two versions of Ruby 1.9 and Ruby 1.8 ... Certain
> users can use 1.9
>
> After creating a rails app (rails new app) , When a script performs
> `bundle
> install`, the gems are trying to get installed in /opt/ruby/.
> How to configure it to install it in user_home directory ?
>
> I don't want to use the solution, where I install the gems as the root
> user
> to the ruby bin directory.

Are you not able to use one of the Ruby version managers?

https://github.com/sstephenson/rbenv
or
https://rvm.io

-- 
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/599e4eb562554a750dd1d79ab1070756%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Installing gems to user directory - Configurations - How to ?

2013-06-24 Thread Dheeraj Kumar
You could use rvm or rbenv instead.
On Jun 24, 2013 10:05 PM, "Boopathi Rajaa"  wrote:

> I compiled Ruby from source, and installed it to /opt/ruby/ .
> The purpose is to have two versions of Ruby 1.9 and Ruby 1.8 ... Certain
> users can use 1.9
>
> After creating a rails app (rails new app) , When a script performs
> `bundle install`, the gems are trying to get installed in /opt/ruby/.
> How to configure it to install it in user_home directory ?
>
> I don't want to use the solution, where I install the gems as the root
> user to the ruby bin directory.
>
> This is the error that I get:
>
> Gem::Exception: Cannot load gem at
> [/opt/ruby/lib/ruby/gems/1.9.1/cache/multi_json-1.7.7.gem] in
> /home/boopathi/apps/abcd
> An error occurred while installing multi_json (1.7.7), and Bundler cannot
> continue.
> Make sure that `gem install multi_json -v '1.7.7'` succeeds before
> bundling.
>
>  --
> 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/12228825-793f-4fa2-b7a1-7386c342b652%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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/CA%2BsTbyv59T82RA7aUpE9v14Pin%2Bb5auYE%3D20iw9MOkv9u3OMnQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] ruby pack unexpected results

2013-06-24 Thread John Merlino
I have two hex values and expect back the value "3007"


What pack does is take the array of hexes and formats them into a string 
(if ASCII representation, then ASCII character, otherwise the raw hex as 
string). Then I take the string of hexes and unpack them, that is, get the 
unsigned int representation of those bytes:
[0xBF, 0xB].pack('C*').unpack('I')[0]

So I expect back 3007, but the above produces nil.

This is what I want to achieve:

[0xBF, 0xB].reverse.inject { |s,v| s * 256 + v }
 => 3007 

But I want to use unpack instead of inject.


-- 
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/4d8e50a7-dc9e-4da9-b8e3-bc4ba4f5c62f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Ruby On Rails integrate with Object C

2013-06-24 Thread Robert Walker
haxuan lac wrote in post #1113439:
> I want to build Application with ROR
> and this App can integrate with Object same as Client
> But I don't know how to build it
> Please give me some advice for it.
> Thanks.

You might want to try this:

https://github.com/RestKit/RestKit

-- 
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/5094284d3e540a1e17c9829221a7a5de%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Installing gems to user directory - Configurations - How to ?

2013-06-24 Thread Boopathi Rajaa
I compiled Ruby from source, and installed it to /opt/ruby/ . 
The purpose is to have two versions of Ruby 1.9 and Ruby 1.8 ... Certain 
users can use 1.9

After creating a rails app (rails new app) , When a script performs `bundle 
install`, the gems are trying to get installed in /opt/ruby/. 
How to configure it to install it in user_home directory ?

I don't want to use the solution, where I install the gems as the root user 
to the ruby bin directory. 

This is the error that I get:

Gem::Exception: Cannot load gem at 
[/opt/ruby/lib/ruby/gems/1.9.1/cache/multi_json-1.7.7.gem] in 
/home/boopathi/apps/abcd
An error occurred while installing multi_json (1.7.7), and Bundler cannot 
continue.
Make sure that `gem install multi_json -v '1.7.7'` succeeds before bundling.

-- 
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/12228825-793f-4fa2-b7a1-7386c342b652%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Ruby On Rails integrate with Object C

2013-06-24 Thread haxuan lac
I want to build Application with ROR
and this App can integrate with Object same as Client
But I don't know how to build it
Please give me some advice for it.
Thanks.

-- 
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/93df0036f72ff4c972e9da1312c53d26%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Relational DB - Related and not Related

2013-06-24 Thread Dave Aronson
On Mon, Jun 24, 2013 at 10:11 AM, Colin Law  wrote:

> If the user can only be a member of one group then use User belongs_to
> group.

Oh, good point.  I was assuming (and you know what happens then!) that
a User could belong to many Groups.

-Dave

-- 
Dave Aronson, the T. Rex of Codosaurus LLC,
secret-cleared freelance software developer
taking contracts in or near NoVa or remote.
See information at http://www.Codosaur.us/.

-- 
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/CAHxKQih-VLfGY1boeJnOsOSRn-Qi1WSrBG8Sd4tW-DUsbx%2BVQA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Relational DB - Related and not Related

2013-06-24 Thread Colin Law
On 24 June 2013 13:54, Cameron Gilroy  wrote:
> Hi
>
> I'm working on a project that has users and groups, users can be members of
> a group or they can just be a user - what's going to be the best way to deal
> with this?

If the user can only be a member of one group then use User belongs_to
group.  If a particular member does not belong to a group then just
leave group_id nil.  You will obviously have to allow for user.group
== nil in the code where appropriate.  If he can belong to many (or
no) groups then use has_many :through as Dave suggested.  You can test
user.groups to see if he is in any groups.

-- 
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/CAL%3D0gLt99XE6J1YK%2BGk-rjM_JMAt%2BtbZpWrsZ%2BFd%3D%3DkfWx0srA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Relational DB - Related and not Related

2013-06-24 Thread Dave Aronson
On Mon, Jun 24, 2013 at 8:54 AM, Cameron Gilroy  wrote:

> users can be members of a group or they can just be a
> user - what's going to be the best way to deal with this?

has_many :through seems perfect for this, given the many-to-many
nature and the possibility you'll want to have additional info about
the relationship (like when they joined, positions held within the
group, etc.).

-Dave

-- 
Dave Aronson, the T. Rex of Codosaurus LLC,
secret-cleared freelance software developer
taking contracts in or near NoVa or remote.
See information at http://www.Codosaur.us/.

-- 
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/CAHxKQigPKZPovetba%2B-momg2pM7sSyTaA2AA_75bA9J0jp8pig%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Relational DB - Related and not Related

2013-06-24 Thread Cameron Gilroy
Hi

I'm working on a project that has users and groups, users can be members of 
a group *or* they can just be a user - what's going to be the best way to 
deal with this?
I understand the normal has_many relationship just not sure how to do this 
one. Will try to post some code snippets tomorrow.

Thanks, Cameron

-- 
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/cc9e3cfb-9180-4527-af5d-b4b3768a5eb6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Constructor CMS

2013-06-24 Thread Иван Зотов
Hello. I write open source CMS (Constructor) on Rails 4. Version of project 
is 0.7.3 now. I wanted to tell about it when version 1.0.0 will be released 
but I can't wait )).
RoR developers, please look http://github.com/ivanzotov/constructor. This 
CMS has interesting template system, that allow you to build complex web 
sites.
For example avgust-klimat.ru – site built on constructor.

Fork welcome! :)

-- 
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/f97b7e6e-9bb6-4b4e-aebb-29c503a7326a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.