Ruby on Rails Saturday, May 31, 2014

thank you Mike.

Good that you pointed out railstutorial.org. I just checked and Michael
Hartl has updated the Learn Rails by Example to version 4. There is a
free version here to read online:
http://www.railstutorial.org/book/beginning

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

Ruby on Rails

Until Rails 4.0.4 everything was working fine until I upgraded to latest
Rails version. It seems to be a bug because from the error message looks
like rails is doing just a count(Bla bla )without using properly using a
select count(id) from (SELECT COUNT(orders_header.id,
orders_header.created_at) FROM `orders_header` WHERE (shop_id=99 and
customer_id=1 and hash_key like
'539de64e8793790430052bc861dd0ff521334e32')

Is there a workaround for this problem?

query= OrderHeader.select("orders_header.id,
orders_header.created_at").where("shop_id=#{shop_id} and
customer_id=#{customer_id} and hash_key like
'#{current_hash_key}'").order("id desc")
if query.nil?
return true # no duplicates found
end
if (query.count>0) # duplicates found
# I get the error righ here
end
ERROR
SELECT COUNT(orders_header.id, orders_header.created_at) FROM
`orders_header` WHERE (shop_id=99 and customer_id=1 and hash_key like
'539de64e8793790430052bc861dd0ff521334e32')
Mysql2::Error: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to
use near ' orders_header.created_at) FROM `orders_header` WHERE
(shop_id=99 and customer_' at line 1: SELECT COUNT(orders_header.id,
orders_header.created_at) FROM `orders_header` WHERE (shop_id=99 and
customer_id=1 and hash_key like
'539de64e8793790430052bc861dd0ff521334e32')

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

Ruby on Rails




On Fri, May 30, 2014 at 6:25 AM, uorgi poen <ggstack12@gmail.com> wrote:
Hello,

if (verify_login_id = Login.where(params[:email_address], "active" =>1).select('id')# => [#<Login id: 767>] 
verify_admin_id = Admin.where("login_id" => verify_login_id.first.id).exists? #=> true)
statement
else
raise(ActiveRecord::RecordNotFound.new("Authorization is required to access this endpoint!"))
end

Are you trying to test two things in the if statement?

    if (cond1) && (cond2)
       # execute if true
    else
       # execute if false
    end

 

Syntax correct?


--
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/5ac436a3-d03c-488c-841c-f3a38240bdb7%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/CAHUC_t8iQRwfVe77juP%2BFRnJXwA2fCTJ17iMMMPsFQ14dNqRpQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I've put my favicon into app/assets/images and include in my header

<%= favicon_link_tag 'my_favicon.jpg' %>

The favicon is correctly recognized by the browser, so it works
perfectly. When viewing the source code, I see to my surprise that the
following HTML code is generated:

<link href="/assets/my_favicon.jpg" rel="shortcut icon"
type="image/vnd.microsoft.icon" />

Aside from the MIME type (I had expected that rails would generate
image/jpeg), what really puzzles me is the path. The file is definitely
in /assets/images, not in /assets . How can the browser locate the file?

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

Ruby on Rails Friday, May 30, 2014



Τη Δευτέρα, 12 Μαΐου 2014 11:33:24 μ.μ. UTC+3, ο χρήστης Gustavo Gervásio έγραψε:
Good afternoon everyone,
're punctuating a change of programming language in our company's C # for others.
I would like to know the advantages and disadvantages of ruby. Someone uses it as back-end?? or he is more used to front?

Anyone indicates use in the back?

Thanks to friends

Good afternoon to you too.
It depends on what your company is planning to do. Web-based apps and sites or desktop apps ?

--
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/c0024da9-0993-4c55-a1f5-22d4fecf8162%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails



Τη Σάββατο, 10 Μαΐου 2014 1:43:09 π.μ. UTC+3, ο χρήστης Ruby-Forum.com User έγραψε:
I want to build a website with rails similar to vayable.com ,
triplelights.com , odesk.com etc. There will be freelancers and people
hiring. Once the freelancer is hired, he would need to view a list of
bookings. What's the best admin gem for this type of view?

Thanks all

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

I dont think you need an admin gem for that. I'm building a similar web application with different sorts of professionals (plumbers, electricians etc.) and the only thing i use an admin gem (i use activeadmin) for, is for the actual admin to check on his data.
Whatever you are trying to do (i'm not sure about the "list of bookings" you are refering) its not going to be a back-end admin thing.

 

--
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/a4aeb32f-398c-4def-891f-6a8076503477%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

The example included says...

class Customer < ActiveRecord::Base
  has_many :orders, inverse_of: :customer
end
 
class Order < ActiveRecord::Base
  belongs_to :customer, inverse_of: :orders
end

---

Later on, the guid mentions... 

There are a few limitations to inverse_of support:

  • They do not work with :through associations.
  • They do not work with :polymorphic associations.
  • They do not work with :as associations.
  • For belongs_to associations, has_many inverse associations are ignored.

El miércoles, 9 de octubre de 2013 03:42:11 UTC-5, Colin Law escribió:
On 9 October 2013 09:05, gamov <gama...@gmail.com> wrote:
> I also don't understand what they mean since the example seems to contradict
> it...

Exactly which bit of
http://guides.rubyonrails.org/association_basics.html#bi-directional-associations
seems to be a contradiction?  Unless you explain /exactly/ what you do
not understand it is difficult to help.

Colin

>
>
> On Tuesday, November 13, 2012 5:24:16 PM UTC+8, Paul Leader wrote:
>>
>> It is useful in a small number of situations, mostly where you need to
>> ensure that two different references to the same object actually refer to
>> the same instance.  I've only needed to use it twice, both times were where
>> we have callbacks updating multiple related objects based on data held in
>> each other.
>>
>> Anyway, if anyone else does understand what that caveat actually means I'd
>> appreciate an explanation.
>>
>> On Tuesday, November 13, 2012 4:17:22 AM UTC, Greg Donald wrote:
>>>
>>> On Mon, Nov 12, 2012 at 4:09 AM, Paul Leader <pa...@paulleader.co.uk>
>>> wrote:
>>> > Perhaps I'm bing a bit thick and missing something obvious (possible),
>>> > but I
>>> > found the caveats listed in section 3.5 of the Associations Rails Guide
>>> > badly worded and confusing.
>>> >
>>> > The section gives an example with a has_many <-> belongs_to
>>> > relationship is
>>> > setup with inverse associations on both side, but then states the
>>> > caveat
>>> > "For belongs_to associations, has_many inverse associations are
>>> > ignored."
>>> >
>>> > Could someone actually explain what that means in concrete terms? The
>>> > example and the caveat appear to be contradictory. If the caveat is
>>> > correct
>>> > then I'm not sure I understand how the example works.
>>>
>>> I've never needed :inverse_of.  Looks like academic masturbation to me.
>>>
>>>
>>> --
>>> Greg Donald
>
> --
> 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-ta...@googlegroups.com.
>
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/c7974de4-f687-40f5-849d-c5d9ab416440%40googlegroups.com.
>
> For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+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/e696f042-f09d-4c32-ab99-bb1ae854c201%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails


Thanks Matt for your reply! Unfortunately, I don't see any log file in suggested locations the blog referred to:

/var/log/cron/var/log/messages and /var/log/syslog

There is no tail trace my development log file generates.

I am using RVM and bundler for gems. I found similar issue for Rails 4 here but it is unanswered: 


I think whenever is a heavily used rails gem and other developers on this forum who have used this gem can help debugging this problem as well. I hope I followed all the steps for integration. 

Thanks.
--
Regards,
Ankur 

On Thu, May 29, 2014 at 9:36 PM, Matt Jones <al2o3cr@gmail.com> wrote:


On Thursday, 29 May 2014 00:55:59 UTC-5, Ankur wrote:

Any help on this will be greatly appreciated! Thanks. 

--
Regards,
Ankur 

On Wed, May 28, 2014 at 10:18 AM, Ankur Kumar <specia...@gmail.com> wrote:

I did the following to implement cron jobs in rails 3 using a "runner" instead of a rake task.

Step 1: I have whenever gem installed and scheduler.rb has following:

      set :environment, 'development'    set :output, {   :error    => "/log/error.log",   :standard => "/log/cron.log"     }      every 1.minute do    runner "Cron.sendAutomaticsSMS()"    end

Step 2:

Cron file: lib/cron.rb

        class Cron < ActiveRecord::Base          def **sendAutomaticsSMS**()           ----some code here ---        end      end

Step 3:

        whenever --update-crontab --set environment=development 

This updates crontab file.

Step 4:

Checked contents of crontab file using:

        crontab -e  

It opens cron tab file which has details of cron job method to be invoked:


        # Begin Whenever generated tasks for: store        # End Whenever generated tasks for: store        # Begin Whenever generated tasks for: /code/rails_projects/new/bhk/bigbhk-     dev/config/schedule.rb      * * * * * /bin/bash -l -c 'cd <*RAILS_APP_PROJECT_LOCATION*> && script/rails runner -e development '\''**Cron.sendAutomaticsSMS()**'\'' >$        # End Whenever generated tasks for: /code/rails_projects/new/bhk/bigbhk-dev/

Step 5:

Running cron job:

        $sudo service cron restart        cron stop/waiting      cron start/running, process 4027

This does not do anything. I wait for operation as defined in sendAutomaticsSMS() method to execute but the cron doesn't even enter this method.



You'll want to find where your cron logs to:


And post any errors you find in there.

A first guess is that the environment cron is setting up for your task isn't the same as the one you use for development; are you using RVM or rbenv? Gemsets?

--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/c3e897e3-874e-49da-80c1-e1c7809fb720%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/CALSL1ePXe%3DQOBgynBRFF2LuZkJ4xtaNShO0QiCeyLTyqAshNQg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Hi guys,

I'm one of the authors of Feedly (python). So it does sound exactly like
what you're looking for but in the wrong language :)

The same team behind Feedly is also offering a hosted solution now
called getstream.io
Have a look at the getting started, https://getstream.io/get_started/
We have client libraries available for Ruby, PHP, Python and Node.

Internally its using a highly optimized system with Cassandra. It will
be substantially cheaper than running your own Redis cluster. In
addition it's currently in Beta, which means its free and comes with
free tech support :)

In case you are looking for building your own solution have a look at
this article on highscalability:
http://highscalability.com/blog/2013/10/28/design-decisions-for-scaling-your-high-traffic-feeds.html

Cheers,
Thierry

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

Ruby on Rails

Hello,

if (verify_login_id = Login.where(params[:email_address], "active" =>1).select('id')# => [#<Login id: 767>] 
verify_admin_id = Admin.where("login_id" => verify_login_id.first.id).exists? #=> true)
statement
else
raise(ActiveRecord::RecordNotFound.new("Authorization is required to access this endpoint!"))
end

Syntax correct?


--
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/5ac436a3-d03c-488c-841c-f3a38240bdb7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Please change my email address:

jimandirenewhite@gmail.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/E3AD9206-2A9F-4E12-8028-480B095EB08C%40bresnan.net.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I resolved that problem.

I done somethig like so to update each column:

def update_multiple
@postis = Posti.find(params[:posti_ids])

@postis.each do |posti|
posti.update_column(:stato, params[:posti])
end
redirect_to prenotazione_path(params[:spectacle_id])
end

<%= form_for :posti, :url => update_multiple_path, :html => { :method =>
:put } do |f| %>
<%= hidden_field_tag "spectacle_id", params[:spectacle_id] %>
<strong>Posti scelti:</strong>
<ul>
<% for posti in @postis %>
<li>
<%=h posti.numero %>

<%= hidden_field_tag "posti_ids[]", posti.id %>
</li>
<% end %>
</ul>

<p>

<%= f.hidden_field :stato, :value => "checked" %>
</p>
<p><%= f.submit "PRENOTA" %></p>
<% end %>

It works very well and i am so very happy. Thank you Colin for helps. I
will very well a tutorial when i will finish all my esams at university.
Ruby on Rails is the best :)

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

Ruby on Rails


Hi,
In my system, netstat -nlt | egrep ':443' does output anything.....

 So far i downloaded cert certificate, should'nt i do it instead create self signed cert  in my local itself?? Also plz educate whatz the difference that  these two , 1. set my host as SSL server  2.and  simply self sign certificate installation, among this which will I require to fix this  HTTPI::SSL error which occurs in my local implementation of SOAP webservice (SSL enabled)? Plz give ur views to fix this.


On Wed, May 28, 2014 at 8:51 PM, Matt Jones <al2o3cr@gmail.com> wrote:


On Wednesday, 28 May 2014 08:31:41 UTC-5, Usha wrote:
Hi plz see below for the ssl doctor script output:

export SSL_CERT_FILE=/usr/lib/ssl/cert.pem &  export SSL_CERT_DIR=/usr/lib/ssl

ruby doctor.rb localhost
/usr/local/bin/ruby (1.8.7-p330)
OpenSSL 0.9.8k 25 Mar 2009: /usr/lib/ssl
SSL_CERT_DIR="/usr/lib/ssl"
SSL_CERT_FILE="/usr/lib/ssl/cert.pem"

Error: connection refused


Unless you've set up an SSL server on your local machine, this isn't going to work. Try pointing the script at the actual server that you're getting the SSLErrors from.

--Matt Jones
 



On Wed, May 28, 2014 at 12:36 AM, Matt Jones <al2...@gmail.com> wrote:


On Tuesday, 27 May 2014 00:51:47 UTC-5, Usha wrote:
Dear All,

rvm ssl updated sucessfully and Openssl/ca cert seems to be correct in my system but still i get  HTTPI::SSL Error, Plz help me , my environment as follows:

$ whereis openssl
openssl: /usr/bin/openssl /usr/include/openssl /usr/share/man/man1/openssl.
1ssl.gz

$ env | grep -i "ssl"
SSL_CERT_FILE=/usr/lib/ssl/cert.pem

$ rvm osx-ssl-certs status all
Certificates for /usr/lib/ssl/cert.pem: Up to date.

rvm osx-ssl-certs status all
Certificates for /usr/lib/ssl/cert.pem: Up to date.

$ rvm reload
RVM reloaded


Still it throws the following error, plz suggest how to resolve this, I have spent nearly one day still cant figure out the issue, plz help me , the error as follws:

HTTPI::SSLError in searchesController

SSL_connect returned=1 errno=0 state=SSLv3 read server hello A: sslv3 alert handshake failure
SSL_connect returned=1 errno=0 state=SSLv3 read server hello A: sslv3 alert handshake failure RAILS_ROOT: /usha/myapp
2.1.0/lib/httpi/adapter/httpclient.rb:28:in `request' /ruby-1.8.7-p330/gems/httpi-2.1.0/lib/httpi.rb:140:in `request' .rvm/gems/ruby-1.8.7-p330/gems/httpi-2.1.0/lib/httpi.rb:112:in `post' /.rvm/gems/ruby-1.8.7-p330/gems/savon-2.3.2/lib/savon/operation.rb:86:in `call_with_logging' .rvm/gems/ruby-1.8.7-p330/gems/savon-2.3.2/lib/savon/request_logger.rb:12:in `call' rvm/gems/ruby-1.8.7-p330/gems/savon-2.3.2/lib/savon/request_logger.rb:12:in `/.rvm/gems/ruby-1.8.7-p330/gems/savon-2.3.2/lib/savon/client.rb:36:in `call'

Any help is appreciated, Plz shed some light in this issue.

Mislav's ssl doctor script (bottom of the post) can be useful:


If nothing else, posting what it outputs should provide more information to troubleshoot this issue.

--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-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.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/fb80f6ba-b4ec-46b1-9990-108acf2fc738%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/CAKNenNABFJ4Zewo8cb6hAqi-Zkz6XsO5%3D%3DOf30wnCWA9twRXJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

On 28 May 2014 19:32, Sheyam Selvaraj <smartsheyam@gmail.com> wrote:
> When I try to run my Ruby on Rails app it shows the error page
> I tried rake db:drop
> rake db:create
> rake db:migrate
> rake db:seed
> still the problem persists
> how can I fix this issue

It is not a good idea to post an image, just copy/paste the important
text here. It is even worse if you just post html into a text email
so that the image does not even appear. Have a look in
development.log first though, often there is useful information there.

Also do the rake messages you posted work ok?
You say you get the error when you run the app, what do you mean by 'run' it?

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

Ruby on Rails Thursday, May 29, 2014

I have a rails application for a research group and the data just grows.
One requested feature in the application is to provide a way to track
the changes made in the data. I have used PaperTrail for this and is
quite efficient for just tracking the changes.

The problem I am in is that there needs to be a way to download the data
at a particular instance and share this URL so that other researchers
can view at the exact same data. I am completely lost at how to achieve
this functionality. Additionally, the models have some associations
between them.
For eg:
Models: Coral, Observation, Measurement, Location
They have a number of associations like many-to-many, one-to-many etc.

Questions
1. How can I version the database so that there can be a URL which
points to the exact data during that version ?
2. Should I create an API for that ?

Please help me :)

Regards
Suren

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

Ruby on Rails

gon is great, and easy to use.

On Friday, May 30, 2014, Dave Sims <davsims@gmail.com> wrote:

I've used the gon gem for this and liked it quite a bit.

https://github.com/gazay/gon

Pierre-Andre M. wrote:

I have a variable created by some ruby in my controller that looks like
this:

@begpoint = row["begpoint"]


and I want to pass it into some js that is referenced from within my
view:

view:

   <% javascript_include_tag "play_time" %>



js (play_time):

I am trying to pass "<beg-point>  into the js [obviously that<>  is not
the right syntax just trying to denote where'd id like the variable to
end up]


var endtime =<beg-point>+10;
myPlayer= document.getElementById('example_video_1');
myPlayer.addEventListener('loadeddata', function(){
     myPlayer.currentTime = 10505.89;
     myPlayer.play();
     myPlayer.addEventListener('timeupdate', function(){
     if (myPlayer.currentTime>= endtime) {
         myPlayer.pause();
     }


Can anyone help?  Thanks

     }, false);

}, false);

--
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/5387C680.30601%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
 greatghoul - Ask and Learn!

--
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/CAFoKNZMGPr%2Bmsf%3DsuutRaH2S9Qphc-uVUNpb_NZkzYVSHkuPmQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails



On Thursday, May 29, 2014 4:22:27 AM UTC-4, himanshu saxena wrote:

I am facing an issue with rails application deployed on Amazon with nginx and unicorn. I am not using any controller or action to render a view, rather I am using a simple html page inside a sub folder of public folder named html_app. And all the css, js and images are kept inside that html_app folder with the same name. see below:
public/html_app/js/test.js
public/html_app/css/test.css
public/html_app/img/test.png
public/html_app/index.html

In order to use browser caching, I have given below configuration for nginx in config/nginx.conf, see below:

upstream unicorn {
server unix:/tmp/unicorn.cache_app.sock fail_timeout=0;
}

server {
listen 80;
server_name x.x.x.x;
root /home/ec2-user/cache_app/public;

# location ^~ /home/ec2-user/cache_app/public {
# gzip_static on;
# expires max;
# add_header Cache-Control public;
# }

location ^~ /.(jpg|jpeg|gif|css|png|js|ico)/ {
# gzip_static on;
expires 1d;
# add_header Cache-Control public;
# add_header Last-Modified "";
# add_header ETag on;
# break;
}

try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn;
}

error_page 500 502 503 504 /500.html;
client_max_body_size 20M;
keepalive_timeout 10;

}

Everything is working except, expires in location block, if I define expires globally, it works, but not inside the location.

Please suggest, where am I wrong ?

Thanks


I'm a little rusty on this, but i think it's your regex.  you definitely need a $ sign.  as it's written, it will match only the filenames .jpg, .peg, etc (filenames that actually have only those four characters).  I also seem to remember the ^~ is used when specifying directory entries vs regex expressions.  The following might work

location ~* \.(jpg|jpeg|gif|css|png|js|ico)$ {

 

--
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/6be38f5e-d17e-4f85-a911-b49a2f89ca61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

I've used the gon gem for this and liked it quite a bit.

https://github.com/gazay/gon

Pierre-Andre M. wrote:


I have a variable created by some ruby in my controller that looks like
this:

@begpoint = row["begpoint"]


and I want to pass it into some js that is referenced from within my
view:

view:

   <% javascript_include_tag "play_time" %>



js (play_time):

I am trying to pass "<beg-point>  into the js [obviously that<>  is not
the right syntax just trying to denote where'd id like the variable to
end up]


var endtime =<beg-point>+10;
myPlayer= document.getElementById('example_video_1');
myPlayer.addEventListener('loadeddata', function(){
     myPlayer.currentTime = 10505.89;
     myPlayer.play();
     myPlayer.addEventListener('timeupdate', function(){
     if (myPlayer.currentTime>= endtime) {
         myPlayer.pause();
     }


Can anyone help?  Thanks

     }, false);

}, false);

Ruby on Rails

Pierre-Andre M. wrote in post #1147586:
> I have a variable created by some ruby in my controller that looks like
> this:
>
> @begpoint = row["begpoint"]
>
>
> and I want to pass it into some js that is referenced from within my
> view:

There are several way of doing this, but the simplest is to use HTML5
data- attributes.

Example:

HTML:

<body data-begpoint="<%= @begpoint %>">
... page content
</body>

jQuery:

var begpoint;

$(funtion() {
begpoint = $('body').data('begpoint');
});

So to think of is as "pass it to JavaScript" is sort of inside out. You
use JavaScript to "get" the value from the DOM. jQuery gives you nice
syntax for doing just that.

This is good for relatively small amount of data. If you need lots of
data in your JavaScript there are alternatives to this technique. A good
place to learn something about those techniques is something like
Backbone.js, Ember.js or Angular.

http://backbonejs.org
http://emberjs.com
https://angularjs.org

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

Ruby on Rails

I have a variable created by some ruby in my controller that looks like
this:

@begpoint = row["begpoint"]


and I want to pass it into some js that is referenced from within my
view:

view:

<% javascript_include_tag "play_time" %>



js (play_time):

I am trying to pass "<beg-point> into the js [obviously that <> is not
the right syntax just trying to denote where'd id like the variable to
end up]


var endtime = <beg-point>+10;
myPlayer= document.getElementById('example_video_1');
myPlayer.addEventListener('loadeddata', function(){
myPlayer.currentTime = 10505.89;
myPlayer.play();
myPlayer.addEventListener('timeupdate', function(){
if (myPlayer.currentTime >= endtime) {
myPlayer.pause();
}


Can anyone help? Thanks

}, false);

}, false);

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

Ruby on Rails

Wow...I was very close. my issue was currentTime vs currenttime. A
Captial-T was the answer to all my woes.

The lower-case t created a new function (currenttime) that it seemed to
have no idea what to do with other than put the value in it that I
passed.

Any who on to the next challenge.

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

Ruby on Rails

On 28 May 2014 22:35, Simon Eric <lists@ruby-forum.com> wrote:
> @postis is an string.

No it isn't, you had
@postis = Posti.where(:stato => "unchecked" , :spectacle_id =>
params[:spectacle_id] , :hall_num => params[:sala])
so why would it be a string? The method 'where' returns (effectively)
an array of records, hence the error you saw. So *please* just work
right through a good tutorial. the time spent will be repaid many
times over.

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/CAL%3D0gLu8wS1waF%3Dw6LUUQUFOkiLcQB%3DNUE-ih4LHaQc6We%3DHNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Walter...I tried my best to get this to some public location to no
avail.

at this point I changed everything to myPlayer


var endtime = 10505.89+10;
myPlayer= document.getElementById('example_video_1');
myPlayer.addEventListener('loadeddata', function(){
myPlayer.currenttime = 10505.89;
myPlayer.play();
myPlayer.addEventListener('timeupdate', function(){
if (myPlayer.currentTime >= endtime) {
myPlayer.pause();
}

}, false);

}, false);

When I use the debugger in Google Chrome I'm no longer getting any
errors...however the script doesn't seem to be executing. In the
javascript console within the browser the only thing I've been able to
get working FOR SURE is myPlayer.play() and myPlayer.pause

When I try myPlayer.currenttime=20 it returns the value "20" but still
wont play at that time. I've been going around in circles on this for
days. very frustrated since it works great outside of rails.

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

Ruby on Rails

A lot of really helpful people on these forums.

I'll bet this person went ahead and did this:

production:
secret_key_base: 12345

Someone probably could have mentioned that <%= ENV["SECRET_KEY_BASE"] %>
loads the config from something called an "environment variable", in
this case SECRET_KEY_BASE, which has to be defined per-server, and they
should go read up on where to define it for their particular system.

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

Ruby on Rails

On May 29, 2014, at 12:56 PM, Asa Romberger wrote:

> I am working on a Rails app where people sign up and have a profile. When they are first signing up, they fill in their profile but I have an additional question when they are creating their account that alters the initial configuration of the account but is never used afterwards, so I don't want to include it in the profile. It is a multiple choice question with certain validation rules. How do I go about including this in the form?

How serious do these validations need to be? You may be able to do all of this in the view, using JavaScript for validation. As long as the result of the choice being made here is backed up by actual validations on your model, you should be fine.

Walter

>
> --
> 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/10ef46b7-c3b1-4e3d-b821-785e7967b12c%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/F3FFFDFA-5ED1-4ECE-AEEC-E88041A60893%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.