Ruby on Rails Tuesday, September 30, 2014

On Tuesday, September 30, 2014 10:24:44 AM UTC+1, mitin...@gmail.com wrote:
Hello,
I have been trying to deploy rails application on HostGator. As I am new to deployment I am facing the following problem.  I am unable to bundle few gems(contact_us, mysql2) with ruby 1.8.7 installed on Hostgator. Can anyone guide on how to deploy an existing application of versions Ruby-1.8.7 and rails 3.2.19 via hostgator. 


Ruby 1.8.7 is completely unsupported - no more security patches. If hostgator can't sort you out with a newer version of ruby then it's time to run a mile.

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+unsubscribe@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/0e824923-77d7-4052-afa5-40c002cee23e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

On Tuesday, September 30, 2014 10:23:41 PM UTC+1, Ruby-Forum.com User wrote:
The error is that...

...if I invoke an action on the UserController which is implemented in
its base controller, even if the base controller has a before_filter
excluding auth_check to run for that action it will still be run unless
UserController explicitly excludes the auth_check from running for the
inherited action.

I've been debugging this and can see that the debugger first processes
BaseController.before_filter followed by UserController.before_filter
but I don't know how the filters are stored and chained. I think that is
where the problem is.


That makes more sense and is now sounding like something i'd expect. You might try  using skip_before_filter .

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+unsubscribe@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/05da5aaa-3cf4-4991-9920-540475803ff9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails



On Wednesday, October 1, 2014 2:18:42 AM UTC+1, Ruby-Forum.com User wrote:
I do  a create on an Active Record model in a controller and it's doing
something strange.  It's primary key (id) is nil, created/updated are
nil as well.


That sounds like the model wasn't saved. Probably a failed validation or a before_save that returned false.

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+unsubscribe@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/af6247a7-37fb-4238-8384-3bd801ba15d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Finally man after long time one person reply for this question.

Thanks @Clayton for your suggestion.I want to try in my app.

--
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+unsubscribe@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/59ce2138322c2b762251afe154d73d9b%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

What are you trying to do?
Couple things I'll mention now

Html5 getusermedia you can grab a users webcam and mic

If you are wanting to share vid streams youre going to need a server. Darwin qtss for mp4 or icecast2 which does theora vid.

Then one just connects the users webcam source to the broadcasting server



On 29 September, 2014 9:19:17 PM PDT, Sai Ch <lists@ruby-forum.com> wrote:
Can anybody know the live streaming in rails please suggest me../yes\?

--
Sent from my Android

Ruby on Rails

I do a create on an Active Record model in a controller and it's doing
something strange. It's primary key (id) is nil, created/updated are
nil as well.

A few of the columns/attributes are nil as well. The model instance
gets created but the id is nil.

Rspec fails for the model because its id is nil (because it's being
passed to other models)

Any ideas?

--
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+unsubscribe@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/37110ef9494a9cd4f39deafb95ed465c%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Amazing Opportunity to work with start-up Company.  Base + Super + Share Equity . Also bonus Share Equity on each App that is developed!! Great chance for Career progression!!! Sydney CBD based.

My client has a very unique service offering , not only do they develop their clients app , )which by the way you get share equity on) you also get the opportunity to provide consultative and technical advice to help get their plans up and running.

This is the ideal job for any geek.  My client are a team of experienced entrepreneurs, android, ios, ruby geeks. If you are passionate about coding, startups and people then our team is the right fit for you.


They are currently working on some amazing game changing development projects with experienced entrepreneurs and we're looking for a Ruby on Rails developer who is good in Android too. Your key responsibility is building a JSON API for iOS, Android apps they have. Also being able to help the android developers whenever needed.

Of course you should be able to switch between languages, platform whenever required.

Skills & Experience:


* Business management and people skills is a must!
* Ruby on Rails/Ruby - more than 5 years commercial experience
* Systems Architecture
* Android - more than 2 years
* Insight into the challenges facing a high-traffic, public website, apps
* Read at least 1 gem source file
* Strong experience designing and building web applications

* An understanding of when an RDBMS is appropriate and when to use a NoSQL solution

Attributes

* Thrives under pressure and loves a challenge
* Has a can do attitude and works well in a team environment!
* Believes there is a solution to every problem
* Open minded
* Motivates team members

Also its beneficial if you know these:

* Front end - HTML, CSS, Javascript, jQuery for more than 3 years (almost any rails developer knows them)
* AngularJS, BackboneJS
* TDD, Agile
* Unit Testing
* Used many gems and android libraries
* iOS

Having experiences with either banks, accounting systems or large systems with large transaction.


Send your CV to matthew.bradbury@au.recruitloop.com or call Matt on 0424329788 for more information.


--
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+unsubscribe@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/8f32a3e7-e943-42ce-9b6e-f171c62f9679%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Wow, that's a great explanation Matt. I was not aware of the subtle differences.

It sounds like a sensible default would be to use `size`, unless you know you need a specific behaviour..?



On 1 October 2014 03:03, Matt Jones <al2o3cr@gmail.com> wrote:


On Monday, 29 September 2014 23:15:36 UTC-4, Austin York wrote:
In a todo list-style app, I have the following ActiveRecord model method:

class Task < ActiveRecord::Base
 
# ...
 
def project_name
    project
.tasks.length > 0 ? "#{project.name} - #{name}" : project.name
 
end
end

The idea is to provide additional project information if there are one or more tasks on the project.

However, when invoked regularly on views this creates performance concerns (especially with a growing data set).

What is the best way to optimize this query so that it doesn't create N+1 query type issues when invoked from "each" loops in the view?

+1 what Michał said about eager-loading. One additional tricky thing: prefer `size` over `length` for associations and relations. In plain Ruby, `size`, `length` and `count` are more or less identical - but for ActiveRecord collections they have slightly different meanings:

* `length` is the most straightforward: it's ALWAYS the number of records in the collection. If the collection isn't currently loaded, calling `length` on it will trigger a SQL query to load all the records.

* `count` is the opposite: it ALWAYS runs a SQL query. It doesn't load records, it uses SQL's `COUNT()` function. It can also return things that aren't numbers; doing `Task.group(:project_id).count` will give you back a hash with `project_id`s as keys and the number of matching tasks as values.

* `size` is the middle: if the collection is loaded, it works like `length`. Otherwise it works like `count`...

--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+unsubscribe@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/e6771c47-1c12-4e5a-8fe6-73af4d7b26e3%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@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/CABLJ1D%2B1A0ygjEfirVBO6dKxD453-54CinFaW%3D%3DrYrs4DkxNZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Yup, you can get perfect routes by using above mentioned method...!

--
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+unsubscribe@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/ed84e2aae91493112f9d86f1fe3984e2%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Thanks for your feedback Fred.

I should have added that I'm using very old Ruby (1.8.7) and Rails
(2.2.2) versions.

Also, I tried to make my example as simple as possible. In reality, it
is a little more complicated.

The error is that...

...if I invoke an action on the UserController which is implemented in
its base controller, even if the base controller has a before_filter
excluding auth_check to run for that action it will still be run unless
UserController explicitly excludes the auth_check from running for the
inherited action.

I've been debugging this and can see that the debugger first processes
BaseController.before_filter followed by UserController.before_filter
but I don't know how the filters are stored and chained. I think that is
where the problem is.

Pete

--
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+unsubscribe@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/1f21ceed3279195fbb7c8b2a4b546857%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Ok, DBA and I figured this out. The test schema and prod schema were not identical and the sequence has been messed up.
I still don't know why the pk key constraint name (that was only in prod db schema at that time) appeared on the error message during testing.
Anyway, thank you all for your help...!

Daniel

On Sat, Sep 20, 2014 at 11:12 AM, Walter Lee Davis <waltd@wdstudio.com> wrote:
On Sep 18, 2014, at 5:48 PM, kimda <tkkscf@gmail.com> wrote:

> If I write the error message instead of xxxxxx, it is:
> OCIError: ORA-00001: unique constraint (ABCSIGN_DBA.PK_ATTEND_IP) violated: INSERT INTO attend_ip (xxx, xxx, xxx, .........)
>
> The PK prefix looks like a violation of the primary key. Maybe, inserting same row again or some kind of replay happens. If so, why this is not happening in production with same code???
>
> How do I check if that case happens?
>
> Daniel
>

In the config/environments/production.rb file, turn the log level up to debug, and restart the server, and tail the log. You should be able to see full queries and all as you hit various test pages in the site.

Walter

>
> On Thursday, September 18, 2014 3:35:50 AM UTC-5, kimda wrote:
> Hello,
>
> I have developed a small RoR app(ruby 1.8.7, rails 2.1.0, rubygem 0.9.4) a few years ago and now I moved the app on Windows 2008 server.
>
> I have a weird issue that insert doesn't work all the time. This is the error message and there is no duplicated PK insertion when I check DB table.
>
> ActiveRecord::StatementInvalid (OCIError: ORA-00001: unique constraint (xxxxxxxx) violated: INSERT INTO xxxxxx (xxxx, xxxx, xxxx, xxxx, ......)
> ...
> ...
> ...
>
> I am the only one who is testing and there are no opened sessions. I am sure production DB schema and test DB schema are identical. I tested with all three environments with test DB schema, but didn't help.
>
> One thing to note is that after I get the RoR error message, if I just hit F5 key a few times, the insertion works and I get the next successful page.
>
> This same app is working fine on Windows 2003 server though. (I just copied the app dir and all the RoR setup.)
>
> Any clues?
>
> thanks in advance.
>
> Daniel
>
> --
> 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+unsubscribe@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/3daf3e0a-c703-41ac-b3e5-9fbec634462b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyonrails-talk/PfHk13BmBXk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rubyonrails-talk+unsubscribe@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/8D4717F2-8441-4C98-897E-DE65101E6756%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@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/CALdcBk2nDPNUwRutXDcu%2B3YKV-BNQuT8EzpL57H3ormjsP%2Bk6w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I'd recommend puma ( Application Server ) with Nginx ( Webserver) 

On Tue, Sep 30, 2014 at 11:37 PM, Jason Fleetwood-Boldt <tech@datatravels.com> wrote:

Being old(er), I'm like you. The kids all use nginx these days, often with thin as the webserver. Your mileage may vary.

Obviously, if you're using websockets, you'll need an architecture that supports that.

-Jason


On Sep 30, 2014, at 2:00 PM, Perry Smith <lists@ruby-forum.com> wrote:

> Thank you to Vivek and Jason.
>
> One extra note: this is an internal restricted web site so I can't use
> Heroku for this particular project but that type of information is also
> interesting to me.
>
> On a side note: in the past, I've used Apache.  Sometimes with Passenger
> and sometimes without.  I'm curious on httpd recommendations as well.
>
> Thank you again,
> pedz
>
> --
> 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+unsubscribe@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/179f21c03e0299ca6fb7c7ddcfee3d5c%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.
>

--
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+unsubscribe@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/92B8F1AB-743B-4370-9E9D-D10D69095B9E%40datatravels.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@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/CAFKVRj-PrX4gyZJmT1h654v-H6xGp2%3DKFEv03Nd6kAt0t%3DNO6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Being old(er), I'm like you. The kids all use nginx these days, often with thin as the webserver. Your mileage may vary.

Obviously, if you're using websockets, you'll need an architecture that supports that.

-Jason


On Sep 30, 2014, at 2:00 PM, Perry Smith <lists@ruby-forum.com> wrote:

> Thank you to Vivek and Jason.
>
> One extra note: this is an internal restricted web site so I can't use
> Heroku for this particular project but that type of information is also
> interesting to me.
>
> On a side note: in the past, I've used Apache. Sometimes with Passenger
> and sometimes without. I'm curious on httpd recommendations as well.
>
> Thank you again,
> pedz
>
> --
> 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+unsubscribe@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/179f21c03e0299ca6fb7c7ddcfee3d5c%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.
>

--
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+unsubscribe@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/92B8F1AB-743B-4370-9E9D-D10D69095B9E%40datatravels.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Thank you to Vivek and Jason.

One extra note: this is an internal restricted web site so I can't use
Heroku for this particular project but that type of information is also
interesting to me.

On a side note: in the past, I've used Apache. Sometimes with Passenger
and sometimes without. I'm curious on httpd recommendations as well.

Thank you again,
pedz

--
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+unsubscribe@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/179f21c03e0299ca6fb7c7ddcfee3d5c%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Perry-

You may also want to look into recently introduced Websockets functionality on Heroku

more information here https://devcenter.heroku.com/articles/ruby-websockets

-Jason


On Sep 30, 2014, at 12:53 PM, Perry Smith <lists@ruby-forum.com> wrote:

> I'm starting a new Rails project probably using 4.1 or 4.2. The project
> needs the ability for user's browsers to get updates via push
> notifications. I know that Rails 4 kinda sorta added that but the last
> time I looked it was shaky.
>
> To sketch out what I'd like: suppose a user is looking at a page.
> Think of it as a user looking at a history of activity for a project.
> Another users does an update. I want the first user's browser to get
> the new update. I don't think will work in this situation so I'm
> looking for the server to push the updates out.
>
> What is the current technology? Does Rails 4.1 or 4.2 have everything
> it needs or do I still need some add on gems? If so which ones? If
> Rails is complete, what are some areas of the Rails documentation to
> review?
>
> Thank you for your time,
> pedz
>
> --
> 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+unsubscribe@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/a9ffecae0376009fe900105b3279e74e%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.
>

--
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+unsubscribe@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/B8F59D09-D76B-4918-B73B-D649363264AE%40datatravels.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Thanks Colin.

Another person suggested this:

resources :comedy do
collection do
get :play_quiz
end
end


class ComedyController < ApplicationController
def play_quiz

end
end

Would this be preferable?

--
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+unsubscribe@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/f2f9c3ecec90430a3816c396fbef78af%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails



On Monday, 29 September 2014 23:15:36 UTC-4, Austin York wrote:
In a todo list-style app, I have the following ActiveRecord model method:

class Task < ActiveRecord::Base
 
# ...
 
def project_name
    project
.tasks.length > 0 ? "#{project.name} - #{name}" : project.name
 
end
end

The idea is to provide additional project information if there are one or more tasks on the project.

However, when invoked regularly on views this creates performance concerns (especially with a growing data set).

What is the best way to optimize this query so that it doesn't create N+1 query type issues when invoked from "each" loops in the view?

+1 what Michał said about eager-loading. One additional tricky thing: prefer `size` over `length` for associations and relations. In plain Ruby, `size`, `length` and `count` are more or less identical - but for ActiveRecord collections they have slightly different meanings:

* `length` is the most straightforward: it's ALWAYS the number of records in the collection. If the collection isn't currently loaded, calling `length` on it will trigger a SQL query to load all the records.

* `count` is the opposite: it ALWAYS runs a SQL query. It doesn't load records, it uses SQL's `COUNT()` function. It can also return things that aren't numbers; doing `Task.group(:project_id).count` will give you back a hash with `project_id`s as keys and the number of matching tasks as values.

* `size` is the middle: if the collection is loaded, it works like `length`. Otherwise it works like `count`...

--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+unsubscribe@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/e6771c47-1c12-4e5a-8fe6-73af4d7b26e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

ActionController::Live all the way !!!! :) 

On Tue, Sep 30, 2014 at 10:23 PM, Perry Smith <lists@ruby-forum.com> wrote:
I'm starting a new Rails project probably using 4.1 or 4.2.  The project
needs the ability for user's browsers to get updates via push
notifications.  I know that Rails 4 kinda sorta added that but the last
time I looked it was shaky.

To sketch out what I'd like: suppose a user is looking at a page.
Think of it as a user looking at a history of activity for a project.
Another users does an update.  I want the first user's browser to get
the new update.  I don't think will work in this situation so I'm
looking for the server to push the updates out.

What is the current technology?  Does Rails 4.1 or 4.2 have everything
it needs or do I still need some add on gems?  If so which ones?  If
Rails is complete, what are some areas of the Rails documentation to
review?

Thank you for your time,
pedz

--
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+unsubscribe@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/a9ffecae0376009fe900105b3279e74e%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@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/CAFKVRj_fUc79mLE1r6Sj-M61pxBZa7YbM4NkU4mB7cgJ_4%2BkZg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I'm starting a new Rails project probably using 4.1 or 4.2. The project
needs the ability for user's browsers to get updates via push
notifications. I know that Rails 4 kinda sorta added that but the last
time I looked it was shaky.

To sketch out what I'd like: suppose a user is looking at a page.
Think of it as a user looking at a history of activity for a project.
Another users does an update. I want the first user's browser to get
the new update. I don't think will work in this situation so I'm
looking for the server to push the updates out.

What is the current technology? Does Rails 4.1 or 4.2 have everything
it needs or do I still need some add on gems? If so which ones? If
Rails is complete, what are some areas of the Rails documentation to
review?

Thank you for your time,
pedz

--
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+unsubscribe@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/a9ffecae0376009fe900105b3279e74e%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Here's the link to the posting:  https://employment.umn.edu/applicants/Central?quickFind=123476

We are a super fun and creative academic technology team!  



--
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+unsubscribe@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/d30e56df-c1d3-4734-bdea-73b8cf2407a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails


On Monday, September 29, 2014 9:40:24 PM UTC+1, Ruby-Forum.com User wrote:

class UserController < BaseController
 before_filter :check_auth, :except => [ :getNotifications ]
 # more here...
 def getNotifications()
  getSession()
  # ...
 end
end

 
This strikes me as odd - I wouldn't usually call a parent controller's action explicitly. Either the base controller would implement some non action methods that I'd call or I'd call the base controller functionality via super. 

Having said that, it was my recollection that filters were handled by Action Controller's perform_action so I wouldn't have expected what you saw either

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+unsubscribe@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/a63cfb5e-1006-4edb-968b-816b56c300fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Hello,
I have been trying to deploy rails application on HostGator. As I am new to deployment I am facing the following problem.  I am unable to bundle few gems(contact_us, mysql2) with ruby 1.8.7 installed on Hostgator. Can anyone guide on how to deploy an existing application of versions Ruby-1.8.7 and rails 3.2.19 via hostgator. 

--
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+unsubscribe@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/3f151fe9-661a-4356-87e7-b5bffea3ad2d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Monday, September 29, 2014

You would probably want to make a counter cache for tasks on the project (you can find out more here: http://api.rubyonrails.org/v4.1.1/classes/ActiveRecord/Associations/ClassMethods.html#method-i-belongs_to), and additional when retrieving tasks from the database, when you know you will need their project data, use eager loading (more here: http://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations).

Michał.


On 30.09.2014 05:15, Austin York wrote:
In a todo list-style app, I have the following ActiveRecord model method:

class Task < ActiveRecord::Base
 
# ...
 
def project_name
    project
.tasks.length > 0 ? "#{project.name} - #{name}" : project.name
 
end
end

The idea is to provide additional project information if there are one or more tasks on the project.

However, when invoked regularly on views this creates performance concerns (especially with a growing data set).

What is the best way to optimize this query so that it doesn't create N+1 query type issues when invoked from "each" loops in the view?

(Feel free to post answers on StackOverflow).
--
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+unsubscribe@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/0c714b76-d9d0-4eee-9954-1c50779931bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Can anybody know the live streaming in rails please suggest me../yes\?

--
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+unsubscribe@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/ba47511049addee4cd976e5a5c1b8a43%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

In a todo list-style app, I have the following ActiveRecord model method:

class Task < ActiveRecord::Base
 
# ...
 
def project_name
    project
.tasks.length > 0 ? "#{project.name} - #{name}" : project.name
 
end
end

The idea is to provide additional project information if there are one or more tasks on the project.

However, when invoked regularly on views this creates performance concerns (especially with a growing data set).

What is the best way to optimize this query so that it doesn't create N+1 query type issues when invoked from "each" loops in the view?

(Feel free to post answers on StackOverflow).

--
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+unsubscribe@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/0c714b76-d9d0-4eee-9954-1c50779931bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I have something like this:



=========================================================================
class ApplicationController < ActionController::Base
def check_auth
# ...
end
end

class BaseController < ApplicationController
before_filter :check_auth, :except => [ :getSession ]
# more here...
def getSession()
# ...
end
end

class UserController < BaseController
before_filter :check_auth, :except => [ :getNotifications ]
# more here...
def getNotifications()
getSession()
# ...
end
end
=========================================================================

I'm was expecting wrongly that if UserController#getNotifications calls
BaseController#getSession check_auth would not called.

If I change the before_filter in my UserController to:

before_filter :check_auth, :except => [ :getSession, :getNotifications
]

it works as expected.

Isn't there a way to incorporate the before_filter settings from the
parent controller say during construction of an instance of a sub class?

Thanks for any help in advance
Pete

--
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+unsubscribe@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/ac2a0254bb2dbdc5eb5fbbb299bbc5e3%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails


Interesting... I saw his image just fine (it says Couldn't find article with id='5' incidentally).

I am on Mac OS X Mail client. 

sabrina.ncx@gmail.com --- Yes, Colin is right, you do not need to take a screenshot of the error message, generally we prefer that you copy & paste the text of the error message itself. (You can also paste code, error messages, or stacktraces into http://gist.github.com  click "Create Private Gist" and then provide us with the URL that Gist creates for that)

As far as your original question, it looks like there is no article in the database with id 5. This could happen when you hit "Delete" twice before the app has a chance to reload the page, or maybe you deleted the record already.  Either way, you can drop into rails console and just do Article.find(5) and you will see nil as the result -- indicating that there is no record with an id of 5.

So, your code looks OK but for some reason the id being passed was for a record that didn't exist. If this continues to happen, try copying & pasting the View template into a Gist -- that will help us see the whole picture.

-Jason


On Sep 29, 2014, at 3:24 PM, Colin Law <clanlaw@gmail.com> wrote:

On 29 September 2014 20:09, Norbert Melzer <timmelzer@gmail.com> wrote:
I'd guess that He wanted to Show us a screenshot of the actual errormessage
but his MUA got the HTML-mail wrong. Or our MUA does not support that kind
of embedded images. Since I'm with my mobile right now I can't check the OPs
mailheaders for misinformation.

Ah, you could be right.
@Aspiring Student if so then copy the error out of the server terminal
window and paste it here, assuming it is in the server window.  You
may have to use Ctrl+Chift+C to copy from a terminal window.
If it only appears in the browser then just retype it if you can't
copy text out of it.

Colin


Am 29.09.2014 10:17 schrieb "Colin Law" <clanlaw@gmail.com>:

On 29 September 2014 08:11, Aspiring.Student.programmer
<sabrina.ncx@gmail.com> wrote:
Hey

In section 5.13 of getting started with rails it shows how to delete
data
from the database. When i added the code i got this error. I have
checked my
code and cant find any problems. Help Please

 <img src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAABVYAAA...

You say it is an error but it does not look like an error message, it
looks like some html generated by an image_tag or similar.  Show us
the line in your view that is generating that.  If it is not coming
from a line in your view what do you see in development.log when it
happens?

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+unsubscribe@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/7c102d01-c473-4d0d-b8fb-152df9d7cbed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@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%3D0gLvq%2BsGewfaMpsyF%2BiPpAWA_PYZ9g1-4XKTr1dJfFUMaDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@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%2BbCVsuuBFtF7VrO8-vGLk_3oD2a6Q1S9nhUhC6RyECwD26ScA%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscribe@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%3D0gLvno2EPX8YM0k%2BcbR6jh%2Bm0A%2BxoyAk0TiGN8XdiBUAtfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Ruby on Rails

On 29 September 2014 20:09, Norbert Melzer <timmelzer@gmail.com> wrote:
> I'd guess that He wanted to Show us a screenshot of the actual errormessage
> but his MUA got the HTML-mail wrong. Or our MUA does not support that kind
> of embedded images. Since I'm with my mobile right now I can't check the OPs
> mailheaders for misinformation.

Ah, you could be right.
@Aspiring Student if so then copy the error out of the server terminal
window and paste it here, assuming it is in the server window. You
may have to use Ctrl+Chift+C to copy from a terminal window.
If it only appears in the browser then just retype it if you can't
copy text out of it.

Colin

>
> Am 29.09.2014 10:17 schrieb "Colin Law" <clanlaw@gmail.com>:
>>
>> On 29 September 2014 08:11, Aspiring.Student.programmer
>> <sabrina.ncx@gmail.com> wrote:
>> > Hey
>> >
>> > In section 5.13 of getting started with rails it shows how to delete
>> > data
>> > from the database. When i added the code i got this error. I have
>> > checked my
>> > code and cant find any problems. Help Please
>> >
>> > <img src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAABVYAAA...
>>
>> You say it is an error but it does not look like an error message, it
>> looks like some html generated by an image_tag or similar. Show us
>> the line in your view that is generating that. If it is not coming
>> from a line in your view what do you see in development.log when it
>> happens?
>>
>> 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+unsubscribe@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/7c102d01-c473-4d0d-b8fb-152df9d7cbed%40googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> 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+unsubscribe@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%3D0gLvq%2BsGewfaMpsyF%2BiPpAWA_PYZ9g1-4XKTr1dJfFUMaDQ%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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+unsubscribe@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%2BbCVsuuBFtF7VrO8-vGLk_3oD2a6Q1S9nhUhC6RyECwD26ScA%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@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%3D0gLvno2EPX8YM0k%2BcbR6jh%2Bm0A%2BxoyAk0TiGN8XdiBUAtfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I'd guess that He wanted to Show us a screenshot of the actual errormessage but his MUA got the HTML-mail wrong. Or our MUA does not support that kind of embedded images. Since I'm with my mobile right now I can't check the OPs mailheaders for misinformation.

Am 29.09.2014 10:17 schrieb "Colin Law" <clanlaw@gmail.com>:
On 29 September 2014 08:11, Aspiring.Student.programmer
<sabrina.ncx@gmail.com> wrote:
> Hey
>
> In section 5.13 of getting started with rails it shows how to delete data
> from the database. When i added the code i got this error. I have checked my
> code and cant find any problems. Help Please
>
>   <img src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAABVYAAA...

You say it is an error but it does not look like an error message, it
looks like some html generated by an image_tag or similar.  Show us
the line in your view that is generating that.  If it is not coming
from a line in your view what do you see in development.log when it
happens?

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+unsubscribe@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/7c102d01-c473-4d0d-b8fb-152df9d7cbed%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@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%3D0gLvq%2BsGewfaMpsyF%2BiPpAWA_PYZ9g1-4XKTr1dJfFUMaDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@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%2BbCVsuuBFtF7VrO8-vGLk_3oD2a6Q1S9nhUhC6RyECwD26ScA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I have search tool like "Java Media Framework"
http://en.wikipedia.org/wiki/Java_Media_Framework
for Rails application.
Anybody knows that please suggest me.!!!

--
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+unsubscribe@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/9c57cb0f62b6344fbc059f67979a947d%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Got the solution and sovled, that was the issue with JS

On Sunday, 28 September 2014 19:34:43 UTC+4, amruby wrote:

HI,
I am trying to add the offline access with my rails 4 application with the reference of railscast (http://railscasts.com/episodes/248-offline-apps-part-2), but the problem with rails 4 is its not caching the JS & CSS files. its seems like

CACHE MANIFEST
b84e022ceae173fbc8d0c0dff68b25e9109869d744f42f1cacebfa87b96865a7
404.html
422.html
500.html

NETWORK:
*
is there any way to do the caching js & css with rails 4

--
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+unsubscribe@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/f3803ec8-37e5-465d-99fb-2d983b5c14a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Glad to see it working. Happy Coding :) 

On Mon, Sep 29, 2014 at 12:51 PM, Paolo Wang <paulwangzy@gmail.com> wrote:
I finally got it working in ActiveAdmin without a custom form. I'll post how I did it for references if somebody need.
First I set my custom attributes in the LineItem model:

class LineItem < ActiveRecord::Base
attr_accessor :source
attr_accessor :target

(it doesn't work adding :source and :target to the ActiveAdmin file under permit_params, I get an error that there are no column with :source/:target if not added to the model with attr_accessor)

ActiveAdmin.register Order do

  permit_params :id, :title,
                line_items_attributes: [:id, :order_id, :language_pair_id, :source, :target]

  form do |f|
    f.inputs do
      f.input :title
      f.has_many :line_items, :allow_destroy => true do |cf|
        cf.input :source, :collection => Language.pluck(:lang)
        cf.input :target, :collection => Language.pluck(:lang)
      end
    end
    f.actions
  end

  controller do
    def create
      @order = Order.create(:title => params[:order][:title])
      params[:order][:line_items_attributes].each do |x, y|
        source = Language.find_by_lang(y[:source])
        target = Language.find_by_lang(y[:target])
        pair = LanguagePair.find_by(:source_id => source.id, :target_id => target.id)
        @order.line_items.create(:language_pair => pair)
      end
      create!
    end
  end
end

it work flawlessly.

Thank you all for the 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+unsubscribe@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/8ee16610-4b5b-42a6-9327-7098a42e69df%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@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/CAFKVRj-KNFSgtmwJ0Aw3NEt-8_tVwBcN5ps0NMei%2BeHSZ3WJOw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Recently i have posted this issue, so then i tried another way to cache the javascript and css, things like

This is routes.rb

offline = Rack::Offline.configure  do     cache ActionController::Base.helpers.asset_path("application.css")  cache ActionController::Base.helpers.asset_path("application.js")  cache ActionController::Base.helpers.asset_path("jquery.offline.js")  cache ActionController::Base.helpers.asset_path("jquery.tmpl.min.js")  cache ActionController::Base.helpers.asset_path("json.js")    network "/"  end  get "/application.manifest" => offline

This is the application.html.erb

<!DOCTYPE html>  <html manifest="/application.manifest">  <head>  <title>OfflineTest</title>  <%= stylesheet_link_tag    'application', media: 'all' %>  <%= javascript_include_tag 'application' %>  <%= csrf_meta_tags %>  </head>  <body>    <%= yield %>    </body>  </html>

This is index.html.erb

Listing    <%= form_for Item.new do |f| %>  <p>  <%= f.text_field :name %>  <%= f.submit "Add" %>  </p>  <% end %>    <script type="text/html" id="item_template">  <li>${name}</li>  </script>  <ol id="items">  <li><em>Loading items...</em></li>  </ol>

This is application.js

//= require jquery  //= require jquery_ujs  //= require jquery.tmpl.min  //= require jquery.offline  //= require json  //= require_tree .    $(document).ready(function(){  if ($.support.localStorage) {  $(window.applicationCache).bind("error", function() {    console.log("There was an error when loading the cache manifest.");  });  if (!localStorage["pendingItems"]) {    localStorage["pendingItems"] = JSON.stringify([]);  }  $.retrieveJSON("/items.json", function(data) {    var pendingItems = $.parseJSON(localStorage["pendingItems"]);    $("#items").html($("#item_template").tmpl(data.concat(pendingItems)));  });    } else {  alert("Try a different browser.");  }  });

and added the gem

gem "rack-offline"

after this when i go for the application.manifest , it seems like

CACHE MANIFEST  # 1ad140903542ef1549ddf41cb57e9105786a8b344d7fab9278323e9402e61d14  /assets/application.css  /assets/application.js  /assets/jquery.offline.js  /assets/jquery.tmpl.min.js  /assets/json.js    NETWORK:   /

So the problem coming here like, when i stop the server and check, its not loading the JS and CSS files, that means not loading the data in view, but its working with online, actually i have tried the same way in rails 4.0.2 and ruby 2.0.0 that worked. but when i comes to rails 4.1.6 and ruby 2.1.2 its not working with the offline mode. is there any issues with my configuration and all these?

--
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+unsubscribe@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/4812a05e-b212-4adb-a7b7-ac4f79ab8f55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.