[Rails] Fwd: How to save file to s3 after processing by ffmpeg using carrierwave

2013-09-23 Thread Loganathan Sellapa
HI All,

I am trying to convert the bit rate of the Mp3 file before uploading to S3,
I can able to create version for the mp3 file but the version is not saving
in s3 instead original file is uploading to s3, any help would be really
appreciated

  version :bitrate_96k do
process :resample = 96
  end
def resample(bitrate)
tmp_path
  = File.join( File.basename(current_path), tmpfile )
File.rename current_path, tmp_path
audio_details  = `ffmpeg -i '#{tmp_path}'
21`.split(,).split(\n).flatten
file_bitrate =
audio_details.grep(/bitrate/).grep(/bitrate/).join.split(bitrate:
).last.split(\s).first
unless file_bitrate == bitrate
  `ffmpeg -i #{tmp_path.shellescape}  -acodec libmp3lame -y -ab
96k #{current_path.path}`
  File.unlink(current_path)
 FileUtils.mv(temp_path, current_path)
end
  end


regards,
Loganathan
Mob: +91 7760780741 | +91 9944414388
Skype: loganathan.sellappa
ViewMe http://vizualize.me/loganathan

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


[Rails] Re: Multiple Instances of Server?

2013-09-23 Thread Rosy Catz
Hi,

  I'm using ruby 1.8.7 with rails app(2.3.11) and deployed the app with
apache server. My app performance is too slow so i configured the app
with new relic and could see the ruby has 2 instances. One is for
ruby(nobody) =201 MB  and one more for ruby(root)= 73.9 MB. I killed the
processes but still can see the same. Please help me and say why 2
instances are running for ruby?.

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


[Rails] Two ruby processes are running for one Rails app

2013-09-23 Thread Rosy Catz
Hi,

  I'm using ruby 1.8.7 with rails app(2.3.11) and deployed the app with
apache server. My app performance is too slow so i configured the app
with new relic and could see the ruby has 2 instances. One is for
ruby(nobody) =201 MB  and one more for ruby(root)= 73.9 MB. I killed the
processes but still can see the same. Please help me and say why 2
instances are running for ruby?.

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


Re: [Rails] Fwd: How to save file to s3 after processing by ffmpeg using carrierwave

2013-09-23 Thread Colin Law
On 23 September 2013 13:01, Loganathan Sellapa loganathan...@gmail.com wrote:
 HI All,

 I am trying to convert the bit rate of the Mp3 file before uploading to S3,
 I can able to create version for the mp3 file but the version is not saving
 in s3 instead original file is uploading to s3, any help would be really
 appreciated


   version :bitrate_96k do
 process :resample = 96
   end

 def resample(bitrate)
 tmp_path
   = File.join( File.basename(current_path), tmpfile )
 File.rename current_path, tmp_path
 audio_details  = `ffmpeg -i '#{tmp_path}'
 21`.split(,).split(\n).flatten
 file_bitrate =
 audio_details.grep(/bitrate/).grep(/bitrate/).join.split(bitrate:
 ).last.split(\s).first
 unless file_bitrate == bitrate
   `ffmpeg -i #{tmp_path.shellescape}  -acodec libmp3lame -y -ab 96k
 #{current_path.path}`
   File.unlink(current_path)
  FileUtils.mv(temp_path, current_path)
 end
   end

So which bit is not working?  Is the temporary file being created ok
with reduced bitrate?  Is the original file being replaced with the
new one?

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%3D0gLv%2BN2OV913D6Zj9zWO2mV72PohU%2BjYzeOeT%3Df8YAock5g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] errors.on equilvalent on Rails 4

2013-09-23 Thread Patrick Maciel Campos


Hello!

I'm starting with RoR today, but I buy a RoR 3.2 book, and my installation 
on Ubuntu is Rails 4 and Ruby 2.0.

 

Anyway, in book I have this code:

article.errors.on(:title)

But, not works in Rails 4.

2.0.0-p247 :074  article.errors.on(:title)NoMethodError: undefined method `on' 
for #ActiveModel::Errors:0x000427e238
from (irb):74
from 
/home/patrick/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands/console.rb:90:in
 `start'
from 
/home/patrick/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in
 `start'
from 
/home/patrick/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:64:in
 `top (required)'
from bin/rails:4:in `require'
from bin/rails:4:in `main'2.0.0-p247 :075  

What is equivalent

on( )

method?

 

Thanks!

-- 
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/cf41b4a1-b606-49d7-9bd3-5f48009a0e89%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] submit-a-single-form-to-same-user-model-with-many-user-i

2013-09-23 Thread Ashwani kumar

Can anyone please help me with this question on SO ?

http://stackoverflow.com/questions/18954178/submit-a-single-form-to-same-user-model-with-many-user-id-in-rails-3


-- 
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/f5cc12b6-9962-4e56-a020-a6cd6dfd36ed%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] [JOBS] Looking for Devs in India to work at US on Rhomobile

2013-09-23 Thread Shantanu Pandey
Hi,

Please forward your resumes to care...@rhaegan.com to work on a 
India-United States (onsite + offsite) RoR development project on Motorola 
Rhomobile. Preference to H1B holders. If you have experience on Ruby on 
Rails, but not on RhoStudio, feel free to send your CV along as it won't 
take much time to adjust to APIs. 

Regards,
Shantanu Pandey
CEO
Rhaegan Technologies LLP

-- 
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/6fb6cc2e-12b0-4d07-9ed0-84b4762c1861%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Strong parameters with has_many gives “no implicit conversion of Symbol into Integer”

2013-09-23 Thread Timmie Sarjanen


Trying to create a user from a json request but my server gives me 
typeError (no implicit conversion of Symbol into Integer). I understand 
that it's something wrong with my nested attribute but i dont know what, 
this's driving me crazy..

My Javascript file:

 user = {
 email: @get('email')
 first_name: @get('firstName')
 last_name: @get('lastName')
 password: @get('password')
 password_confirmation: @get('passwordConfirmation')
 registration_completed: true

 authentications_attributes: {
 provider: @get('provider')
 uid: @get('uid')
 }}

 $.post(/api/users, { user })


Params:
 

name, :last_name, :email, :password, :password_confirmation, 
:registration_completed, authentications_attributes: [:id, :user_id, :provider, 
:uid])

Console:

Started POST /api/users for 127.0.0.1 at 2013-09-20 15:39:49 +0200Processing 
by Api::UsersController#create as */*
  Parameters: {user={email=f...@example.com, first_name=Foo, 
last_name=Bar, password=[FILTERED], 
password_confirmation=[FILTERED], registration_completed=true, 
authentications_attributes={provider=facebook, 
uid=1000}}}Completed 500 Internal Server Error in 97ms
TypeError (no implicit conversion of Symbol into Integer):
  app/controllers/api/users_controller.rb:17:in `create'

Create method:

def create  
@user = User.new(user_params)
@user.authentications.build
authorize! :create, @user

if @user.save 
  render json: { user: { id: @user.id, auth_token: @user.session_api_key } 
}, status: 201
else
  render json: { errors: @user.errors.messages }, status: 
:unprocessable_entity
end 

end 

What am I doing wrong? And of course have i accepts_nested_attributes_for 
:authentications in my User.rb file. Thanks!

-- 
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/5e59e147-4987-4e99-87b3-0ec5d05e2d83%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Two ruby processes are running for one Rails app

2013-09-23 Thread Frederick Cheung


On Monday, September 23, 2013 1:12:00 PM UTC+1, Ruby-Forum.com User wrote:

 Hi, 

   I'm using ruby 1.8.7 with rails app(2.3.11) and deployed the app with 
 apache server. My app performance is too slow so i configured the app 
 with new relic and could see the ruby has 2 instances. One is for 
 ruby(nobody) =201 MB  and one more for ruby(root)= 73.9 MB. I killed the 
 processes but still can see the same. Please help me and say why 2 
 instances are running for ruby?. 

 It depends how you are running your app, but passenger for example has a 
separate spawner process responsible for starting new application instances.

Fred

PS: your app is using a version of rails which most likely allows remote 
code execution.



 

 -- 
 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/8f9aea50-e1a8-41cb-8782-7d45a32463db%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Two ruby processes are running for one Rails app

2013-09-23 Thread Rosy Catz
Frederick Cheung wrote in post #1122155:
 On Monday, September 23, 2013 1:12:00 PM UTC+1, Ruby-Forum.com User
 wrote:
 It depends how you are running your app, but passenger for example has a
 separate spawner process responsible for starting new application
 instances.

 Fred

 PS: your app is using a version of rails which most likely allows remote
 code execution.


Please tell me in detail. I couldn't understand your point.

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


Re: [Rails] errors.on equilvalent on Rails 4

2013-09-23 Thread Jordon Bedwell
On Sun, Sep 22, 2013 at 9:23 PM, Patrick Maciel Campos
patrickmaciel.i...@gmail.com wrote:
 I'm starting with RoR today, but I buy a RoR 3.2 book, and my installation
 on Ubuntu is Rails 4 and Ruby 2.0.

 Anyway, in book I have this code:

 article.errors.on(:title)
 But, not works in Rails 4.

On was deprecated and removed in Rails 4... I'm surprised that author
would have even left something like that in a Rail 3.2 guide since it
would have hindered future development... either way, to address your
issue now you simply do `errors[:title]` to pull your error.  If you
are looking for it to return true or false then you should do
`errors[:title].present?` or you can use `blank?` if you please.

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


Re: [Rails] Fwd: How to save file to s3 after processing by ffmpeg using carrierwave

2013-09-23 Thread Loganathan Sellapa
HI Colin,

Th temporary file is created with the reduced bitrate, but I am not able to
find an way to save the  temporary file to s3. Simply I am trying to save
the converted file instead of original file,

regards,
Loganathan
Mob: +91 7760780741 | +91 9944414388
Skype: loganathan.sellappa
ViewMe http://vizualize.me/loganathan



On Mon, Sep 23, 2013 at 6:02 PM, Colin Law clan...@googlemail.com wrote:

 On 23 September 2013 13:01, Loganathan Sellapa loganathan...@gmail.com
 wrote:
  HI All,
 
  I am trying to convert the bit rate of the Mp3 file before uploading to
 S3,
  I can able to create version for the mp3 file but the version is not
 saving
  in s3 instead original file is uploading to s3, any help would be really
  appreciated
 
 
version :bitrate_96k do
  process :resample = 96
end
 
  def resample(bitrate)
  tmp_path
= File.join( File.basename(current_path), tmpfile )
  File.rename current_path, tmp_path
  audio_details  = `ffmpeg -i '#{tmp_path}'
  21`.split(,).split(\n).flatten
  file_bitrate =
  audio_details.grep(/bitrate/).grep(/bitrate/).join.split(bitrate:
  ).last.split(\s).first
  unless file_bitrate == bitrate
`ffmpeg -i #{tmp_path.shellescape}  -acodec libmp3lame -y -ab 96k
  #{current_path.path}`
File.unlink(current_path)
   FileUtils.mv(temp_path, current_path)
  end
end

 So which bit is not working?  Is the temporary file being created ok
 with reduced bitrate?  Is the original file being replaced with the
 new one?

 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%3D0gLv%2BN2OV913D6Zj9zWO2mV72PohU%2BjYzeOeT%3Df8YAock5g%40mail.gmail.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/CAD_i5MEs6Lg3%2BQqV3302FtzCgd2eLk8_ANw02FjxFAcb57CVxA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Rails 4 deprecation of in-place edit methods for collection associations

2013-09-23 Thread Matt Jones


On Tuesday, 17 September 2013 00:43:15 UTC-5, George Georgiev wrote:

 Hi everyone!

 For those of you who are not noticed the in-place edit method for 
 collection associations are broken in the current rails release - 4.0.0,
 and here's what is cooking in the rails master 
 https://github.com/rails/rails/commit/1a40be02113287d9a003f8224e91b9f623857f4b
 and this https://github.com/rails/rails/pull/12227

 In short: it looks like things like has_many.reject!{}, 
 has_many.select!{}, has_many.delete_if{}, has_many.pop etc. will not work 
 as of Rails 4.2.
 I tried to get some answers about the motivation of this decision here 
 https://github.com/rails/rails/pull/12236 but i failed.

 So to the question can someone please explain WHY is this happening?
 Where is the confusion in the examples above?


 Another related ticket: https://github.com/rails/rails/issues/12140

The problem is that using (for instance) delete_if on a collection removes 
things from the in-memory version but doesn't persist the changes. It 
*can't* persist the changes, since the records have been removed from the 
association's list of records. This is EXACTLY the confusion referenced 
in the tickets.

One of your examples in 12236 highlights this issue: these two code 
snippets (in Rails 3 or 4) do not do the same thing:

post.comments.select! { |comment| comment.not_spam? } 
# = filters the array in-memory but does not unlink objects

vs

comments = post.comments.to_a
comments.select! { |comment| comment.not_spam? }
post.comments = comments 
# = unlinks comments that aren't in the filtered array

--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/18f8ba4e-29ec-4c04-863f-1ac857ef4e02%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Rails] How to save file to s3 after processing by ffmpeg using carrierwave

2013-09-23 Thread Walter Lee Davis

On Sep 23, 2013, at 9:57 AM, Loganathan Sellapa wrote:

 HI Colin,
 
 Th temporary file is created with the reduced bitrate, but I am not able to 
 find an way to save the  temporary file to s3. Simply I am trying to save the 
 converted file instead of original file,
 
 regards,
 Loganathan
 Mob: +91 7760780741 | +91 9944414388
 Skype: loganathan.sellappa
 ViewMe
 

If you specify the converted file as a style, then it will be saved alongside 
the original. I am not sure how you would replace the original with the 
converted file, I know I have done this before in Paperclip, but I'm not sure 
how you do it in Carrierwave.

Walter

 
 
 On Mon, Sep 23, 2013 at 6:02 PM, Colin Law clan...@googlemail.com wrote:
 On 23 September 2013 13:01, Loganathan Sellapa loganathan...@gmail.com 
 wrote:
  HI All,
 
  I am trying to convert the bit rate of the Mp3 file before uploading to S3,
  I can able to create version for the mp3 file but the version is not saving
  in s3 instead original file is uploading to s3, any help would be really
  appreciated
 
 
version :bitrate_96k do
  process :resample = 96
end
 
  def resample(bitrate)
  tmp_path
= File.join( File.basename(current_path), tmpfile )
  File.rename current_path, tmp_path
  audio_details  = `ffmpeg -i '#{tmp_path}'
  21`.split(,).split(\n).flatten
  file_bitrate =
  audio_details.grep(/bitrate/).grep(/bitrate/).join.split(bitrate:
  ).last.split(\s).first
  unless file_bitrate == bitrate
`ffmpeg -i #{tmp_path.shellescape}  -acodec libmp3lame -y -ab 96k
  #{current_path.path}`
File.unlink(current_path)
   FileUtils.mv(temp_path, current_path)
  end
end
 
 So which bit is not working?  Is the temporary file being created ok
 with reduced bitrate?  Is the original file being replaced with the
 new one?
 
 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%3D0gLv%2BN2OV913D6Zj9zWO2mV72PohU%2BjYzeOeT%3Df8YAock5g%40mail.gmail.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/CAD_i5MEs6Lg3%2BQqV3302FtzCgd2eLk8_ANw02FjxFAcb57CVxA%40mail.gmail.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/087EC355-CB1F-4BFB-BFC3-76420A4CC0E6%40wdstudio.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Re: Two ruby processes are running for one Rails app

2013-09-23 Thread Frederick Cheung


On Monday, September 23, 2013 2:00:36 PM UTC+1, Ruby-Forum.com User wrote:

 Frederick Cheung wrote in post #1122155: 
  On Monday, September 23, 2013 1:12:00 PM UTC+1, Ruby-Forum.com User 
  wrote: 
  It depends how you are running your app, but passenger for example has 
 a 
  separate spawner process responsible for starting new application 
  instances. 
  
  Fred 
  
  PS: your app is using a version of rails which most likely allows remote 
  code execution. 


 Please tell me in detail. I couldn't understand your point. 


Short version: assuming you  are using passenger, that's just how it works. 
Long version 
http://www.modrails.com/documentation/Architectural%20overview.html

Fred

-- 
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/d432ee44-7724-43e8-9f3e-836dc23b67e4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Rails] Multitenancy and the options to realise it in rails4

2013-09-23 Thread Denny Mueller
Yeah I already found this, but I dont want to digg a complete book about 
this topic, a kind of summary or a discussion about it would be nice.

regards
denym_

Am Montag, 23. September 2013 06:29:37 UTC+2 schrieb tamouse:


 On Sep 21, 2013, at 6:55 AM, Denny Mueller 
 macd...@googlemail.comjavascript: 
 wrote: 

  Ok the situation is that I have an App, where to user can sign in and 
 can use the app save some data like customers and orders to the db. 
  Since I'm using devise for authentication, I realised the multitenenacy 
 with current_user in the controller. So every user has his own data. 
  
  like 
  
def index 
  @customers = current_user.customers 
end 
  
  etc 
  
  This works fine right now. But yesterday I watched some railscast. 
  http://railscasts.com/episodes/389-multitenancy-with-postgresql 
  http://railscasts.com/episodes/388-multitenancy-with-scopes 
  
  As you can see the first one uses pg schemas and the second one works 
 with scopes. Both have the same effect like my way. But what could be the 
 advantages or disadvantages to these 3 ways? Dont want to build further on 
 my app and realise in the end that I picked the wrong way. Maybe in the end 
 of the app there will be a function user can team up and have shared 
 data... but this is just a nice to have. 
  
  Any experince, hints or suggestion on that? 
  
  best regards 
  denym_ 

 Best suggestion here I can make is pick up Radar's book: 

 http://www.goodreads.com/book/show/18333875-multitenancy-with-rails 

 really a great read, very helpful in this. 



-- 
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/7413f6ec-9933-45a9-b73f-5b556a908520%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] redirect on browser success, but redirect on functional test is error

2013-09-23 Thread Taro Kimura
line_items.yml:
one:
  product_id: 1
  cart_id: 1
  quantity: 1

carts.yml:
one: {}

product.rb:
has_many :line_items

cart.rb:
has_many :line_items, dependent: :destroy

line_item.rb:
belongs_to :product
belongs_to :cart

line_item_controller.rb:
def destroy
@line_item = LineItem.find(params[:id])
@cart = @line_item.cart
@line_item.destroy

respond_to do |format|
  format.html { redirect_to @cart }
  format.json { head :no_content }
end
end

line_item_controller_test.rb:

setup do
@line_item = line_items(:one)
end

test should destroy line_item do
  @cart = @line_item.cart
  assert_difference('LineItem.count', -1) do
  delete :destroy, id: @line_item
end

  assert_redirected_to @cart
end


--
rake test:functionals

  1) Error:
test_should_destroy_line_item(LineItemsControllerTest):
ActionController::ActionControllerError: Cannot redirect to nil!



@cart in line_items_controller.rb may be nil, when executing functional
test.

Accessing by browser  line_items/20/ post:delete, correctly redirected
show cart that contain line_items(id:20)

why is functional test error?

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


[Rails] Re: Strong parameters with has_many gives “no implicit conversion of Symbol into Integer”

2013-09-23 Thread Frederick Cheung


On Sunday, September 22, 2013 6:24:47 PM UTC+1, Timmie Sarjanen wrote:

 Trying to create a user from a json request but my server gives me 
 typeError (no implicit conversion of Symbol into Integer). I understand 
 that it's something wrong with my nested attribute but i dont know what, 
 this's driving me crazy..

in general that errors means that something is trying to use an array as a 
hash, ie passing a non integer key to []

 Processing by Api::UsersController#create as */*
   Parameters: {user={email=f...@example.com javascript:, 
 first_name=Foo, last_name=Bar, password=[FILTERED], 
 password_confirmation=[FILTERED], registration_completed=true, 
 authentications_attributes={provider=facebook, 
 uid=1000}}}Completed 500 Internal Server Error in 97ms

 Those parameters aren't right - authentications_attributes should be of 
the form

[ {'provider' = 'facebook', ...} ]

or (since you can't really do arrays of hashes when using regular forms

{
  '123456' = {'provider' = 'facebook', ...},
  '456789' = {'provider' = 'google', ...}
}

The keys in that hash are arbitrary. It's common to use the current time in 
milliseconds - anything that is unique is good enough

Fred 

-- 
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/0871716f-7e4c-43c8-8e30-67625844cd72%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Rails] Create a Functional Test for Session Controller

2013-09-23 Thread andreo
And the answer his dont re-invent the wheel, look at something called 
devise.

-- 
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/5f955c29-e563-4127-b8ba-8b519ae09cf4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] Best way to clear cache of layouts

2013-09-23 Thread Ildar Manzhikov
Hello,
I have editable layouts in my application.
It is not a good way to reset application, after each change of layouts
by touch tmp/restart.txt

Could someone propose other way to reset cache of layouts? Or better
layout that exactly changed.

Thanks, Ildar

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


[Rails] 400 bad request

2013-09-23 Thread Oto Iashvili
Hi,

Im using nginx and rails for my site which contains url with georgian 
letters ie განცხადებები so something like 
http://gancxadebebi.ge/ka/%E1%83%92%E1%83%90%E1%83%9C%E1%83%AA%E1%83%AE%E1%83%90%E1%83%93%E1%83%94%E1%83%91%E1%83%94%E1%83%91%E1%83%98
It is mainly working perfectly but sometimes I receive request with 
truncated url ie 
1 - 
http://gancxadebebi.ge/ka/%E1%83%92%E1%83%90%E1%83%9C%E1%83%AA%E1%83%AE%E1%83%90%E1%83%93%E1%83%94%E1%83%91%E1%83%94%E1%83%91%E1%83%9
(as u can see it should be something after %9)
or
2 - 
http://gancxadebebi.ge/ka/%E1%83%92%E1%83%90%E1%83%9C%E1%83%AA%E1%83%AE%E1%83%90%E1%83%93%E1%83%94%E1%83%91%E1%83%94%E1%83%91%E1%83%98?mc=mini+aipadisearch=%E1%83%AB%E1%83%98%E1%83%94%E1%83%91%E1%83%9

I succeeded to deal when there is no get parameters (first url above) and 
make in that case a redirection to /
when this happen, this line is added to nginx error.log
2013/09/24 00:46:53 [alert] 63547#0: *19359227 pcre_exec() failed: -10 on 
/ka/განცხადებებ� using , client: aa.bb.cc.dd, server: gancxadebebi.ge, 
request: GET 
/ka/%E1%83%92%E1%83%90%E1%83%9C%E1%83%AA%E1%83%AE%E1%83%90%E1%83%93%E1%83%94%E1%83%91%E1%83%94%E1%83%91%E1%8
 
HTTP/1.1, host: gancxadebebi.ge

but for second url, which have get parameter truncated, I can not handle 
that which generate a 400 bad request page.
such request added this line in nginx access.log
aa.bb.cc.dd - - [24/Sep/2013:00:48:47 +0200] GET 
/ka/%E1%83%92%E1%83%90%E1%83%9C%E1%83%AA%E1%83%AE%E1%83%90%E1%83%93%E1%83%94%E1%83%91%E1%83%94%E1%83%91%E1%83%98?mc=mini+aipadisearch=%E1%83%AB%E1%83%98%E1%83%94%E1%83%91%E1%83%
 
HTTP/1.1 400 5 - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 
(KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36

does this mean that nginx accepted the request and then rails coudnt 
resolve it ?

I don't know if problem come from rails or from nginx. For first url, I 
solved it in nginx conf 
here part of my conf

access_log /var/log/nginx/gancx.access.log;
error_log /var/log/nginx/gancx.error.log;

client_body_in_file_only clean;
client_body_buffer_size 32K;
charset UTF-8;
source_charset UTF-8;
client_max_body_size 300M;



error_page  400 404 = @notfound;
error_page  500 502 504 = @server_error;
error_page  503 = @maintenance;

location @notfound {
  rewrite ^(.*)$ $scheme://$host permanent;
}

location @server_error {
rewrite ^(.*)$ $scheme://$host permanent;
}

location @maintenance {
rewrite ^(.*)$ $scheme://$host permanent;
}
sendfile on;
send_timeout 300s;

location / {
proxy_pass http://gancx;
proxy_redirect off;

proxy_set_header   Host $host;
proxy_set_header   X-Real-IP$remote_addr;
proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
charset UTF-8;
client_max_body_size 7m;
proxy_buffer_size  4k;
proxy_buffers  4 32k;
proxy_busy_buffers_size64k;
proxy_temp_file_write_size 64k;
}


thanks for your help

-- 
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/8bc80d48-7163-4445-9335-6d43c3752f2e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Rails] What are the benefits of ruby on rails development?

2013-09-23 Thread Carmen R.
There are a number of companies engaged in offering Ruby on Rails
application development or website designs.

Benefits of ruby on rails development?


•Quick website launch: In just a matter of 6 weeks you can have your
complete website up and running compared to traditional methods that
takes near about 12 weeks for web development. The factors behind its
time saving results include- modular design, leaner code base and
availability of existing plug-ins.

•Easy to make changes: After the launch of websites, one can easily make
relevant changes or modifications be it in terms of adding new features
or making certain changes in the data model.

•Cost effective: You need not spend more if you opt for custom Ruby on
Rails development for your website. This is because of the ease and
speed with which Rails helps in building modifying any website.

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