Ruby on Rails Thursday, January 31, 2013

Hi all

I am working with the paypal recurring gem and rails 3.

I am subscribing different plans for a demo site. with "Basic" and "Premium" plans.

I am doing a refund process for test.


def refund_payment
    ppr = PayPal::Recurring.new({
      :profile_id => self.paypal_recurring_profile_token,
      :transaction_id => "#7RX73297E7023873T",
      :reference      => "1234",
      :refund_type    => :full,
      :currency       => "USD"
    })
    response = ppr.refund
    raise response.errors.inspect if response.errors.present?
    response
  end

For profie id it gets the profile id from the table for each transaction. But incase of transaction id there are no transaction id in response while getting a payment to paypal.
I just hardcoded the transaction id from the last transaction from the website. But it showing error.

[{:code=>"10004", :messages=>["Transaction refused because of an invalid argument. See additional error messages for details.", "The transaction id is not valid"]}]
Thanks in advance
Debadatta

--
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/msg/rubyonrails-talk/-/8wzz2AKXQTMJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

On Feb 1, 5:01 am, "Anush J." <li...@ruby-forum.com> wrote:
> Hi All,
>
> A question on using javascript within a view to render a partial. Been
> struggling wit this for a bit.
> I've multiple partials in my views and I want to replace them within a
> specific div, how do I get this variable 'page' within the
> escape_javascript and replace it with 'reviews' so I can rbender the
> other pages (Such as specials, gallery, etc) within that div.
>
> Thanks. Appreciate the help!
> Below is the code snippet.

You can't - the call to escape_javascript happens server side, whereas
the value of page will only be known client side, at the point where
the user clicks on something. You could load the content via ajax

Fred
>
>   <script type="text/javascript">
>
>   $(function(load_content) {
>     $("#reviews, #specials, #gallery, #location, #contact,
> #about").click(function() {
>       var page = this.id;
>       //alert (page);
>
>       $.pageslide.close();
>       var content = "<%= escape_javascript(render(:partial =>
> 'reviews')) %>";
>       $("#content").html(content);
>     })
>   })
>   </script>
>
> --
> Posted viahttp://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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

I had a hunch that reinstallation or trying a different port weren't necessary. I probed a bit more and found some processes named netsession_win.exe in Task Manager. I stopped these. I then went on to uninstall some software named Akamai* from Add/Remove programs, and now all is well.


Hope this helps someone else.

On Friday, February 1, 2013 11:09:35 AM UTC+5:30, Ruby-Forum.com User wrote:
Tried a different port ?
eg: rails s -p 9001

--
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/msg/rubyonrails-talk/-/go0K_V21_fYJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Tried a different port ?
eg: rails s -p 9001

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

Ruby on Rails

Hi All,

A question on using javascript within a view to render a partial. Been
struggling wit this for a bit.
I've multiple partials in my views and I want to replace them within a
specific div, how do I get this variable 'page' within the
escape_javascript and replace it with 'reviews' so I can render the
other pages (Such as specials, gallery, etc) within that div.

Thanks. Appreciate the help!
Below is the code snippet.

<script type="text/javascript">

$(function(load_content) {
$("#reviews, #specials, #gallery, #location, #contact,
#about").click(function() {
var page = this.id;
//alert (page);

$.pageslide.close();
var content = "<%= escape_javascript(render(:partial =>
'reviews')) %>";
$("#content").html(content);
})
})
</script>

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

Ruby on Rails

Hello All --

I am using jruby 1.6.7.2 with rails 3.2.11 to create a brown bag for
several other developers. I cannot get the migration to work to save my
life...

In my database yaml file I have the following:
---
development:
adapter: jdbc
driver: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@localhost:1521:xe
username: brownbag
password: brownbag
pool: 500
---

When I run:
---
rake db:create --trace
** Invoke db:create (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:create
---

when I run:
---
C:\temp\brownbag\my_workout>rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
rake aborted!
Table schema_migrations does not exist
arjdbc/jdbc/RubyJdbcConnection.java:126:in `columns'
c:/temp/brownbag/gem_home/gems/activerecord-jdbc-adapter-1.2.5/lib/arjdbc/oracle/adapter.rb:358:in
`ora_columns'
c:/temp/brownbag/gem_home/gems/activerecord-3.2.11/lib/active_record ...
----

If I switch my database.yml file to the original slite3 that rails auto
generates all is fine.

If I place the following in irb:

---
require 'rubygems'
require 'activerecord-jdbc-adapter'
require 'active_record'
require 'active_record/version'

a= ActiveRecord::Base.establish_connection(
:adapter => 'jdbc',
:driver => 'oracle.jdbc.driver.OracleDriver',
:url => 'jdbc:oracle:thin:@localhost:1521:xe',
:username=>'brownbag',
:password=>'brownbag'
)

c = a.connection
ct = "CREATE TABLE example (id INT, data VARCHAR(100) )"
d = c.exec_query(ct)
---

The table is created as expected!

Help!

Thanks,

Cris

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

Ruby on Rails

I am unable to install RoR on a VPS running RedHat Linux with 512 MB. When I run "make" and "make install" I get the following output/error below. What can I do to resolve this memory problem? 


It appears I should have sufficient memory to install. I included the results of "make" and "free" to show the failure as well as the available memory.

Thanks in advance!

Andrejs


root@vps [~/ruby-1.9.3-p0]# make
CC = gcc
LD = ld
LDSHARED = gcc -shared
CFLAGS = -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Werror-implicit-function-declaration
XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS =   -I. -I.ext/include/x86_64-linux -I./include -I.
DLDFLAGS =  
SOLIBS = 
compiling parse.c

cc1: out of memory allocating 1904232 bytes after a total of 32403456 bytes
make: *** [parse.o] Error 1


root@vps [~/ruby-1.9.3-p0]# free
             total       used       free     shared    buffers     cached
Mem:        524288     368436     155852          0          0          0
-/+ buffers/cache:     368436     155852
Swap:            0          0          0

--
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/msg/rubyonrails-talk/-/2nsztdHxUhoJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

I have a synchronization problem that I am not sure how to solve in Ruby/Rails. I have a mental model of what I need to do and how it should work, but can't find the way to do it in Ruby/Rails. (I've learned all about Mutexes and transactions and lock! but despite my research, am still stuck). I come from the kernel programming world, so I may be framing this incorrectly. 


Here's the deal - 
1. I have a database object, call it a Meter. Meters have all sorts of associated objects.
2. My users can do things to meters and their associated objects via standard web requests.
3. I have a cron taks that runs on the server (Heroku) periodically and also does things to meters and their associated objects.
4. If a user is mucking about with a specific meter *or* it's associated objects at the same time as the cron task is trying to muck with the same meter or associated objects, then there's potential for a data corruption problem.

So - I need to block the cron task from mucking about with a Meter and all its associated objects while a user is doing so (and vice versa).

In my old kernel world, I would have defined a lock on each meter. Wherever I want to assure that a section of code that mucks with a meter is not running concurrently with another section of code that mucks with the same meter, I would wrap each code section that mucks with meters in a Lock/Unlock pair as follows:

section1:
m = get_my_meter
OSLock(m.lock)
# do section 1 stuff to meter and associated objects
OSUnlock(m.lock)

section2:
m = get_my_meter
OSLock(m.lock)
# do section 2 stuff to meter and associated objects
OSUnlock(m.lock)

The resulting behavior is that (assuming that two code sections tried to operate on the same meter concurrently), one would get there first and the second would be blocked until the first called the OSUnlock. At that time, the second would run and I would be assured that the code sections would always run in sequence for any given meter (as opposed to concurrently).

In Ruby/Rails, I see that there are mutexes, but they seem to be applicable to multiple threads running on the same in memory objects. In my case, the user request is going to load its copy of the meter from the database and the cron task is going to load its copy, so - mutexes don't help. Transactions and pessimistic locking seemed promising, but from my experimentation with them they will only prevent concurrent operations on the specific object that is locked. Operations on associated objects, even if they are inside transaction blocks, can still run concurrently. So - it seems that the executing code is not waiting, rather, the database access, for the locked object only, is waiting.

I need to block the cron task from executing any further than where the lock is taken until the user task releases the lock (and vice versa). How do I do that?

Thanks,
Yoram

--
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/msg/rubyonrails-talk/-/TsEJVTkVDP0J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

tl;dr Yes, you /can/ even if Colin's advice is good (AND I agree with him!)
customer = Customer.new(other_attributes_here) {|c| c.id = user.id }
customer.save

On Jan 31, 2013, at 11:01 AM, Nishan T. wrote:

> I'm migrating the tables with existing data
> I've users table and all other tables contains the user_id column and
> now i need seperate the users into two (users & customers) tables
> So i need to migrate the new customers table with existing users records
> where the user type with customer
>
> I need to create a customers table and set the id of users records with
> user type as customer,
> which will be easy instead of migrating many of other tables(which is
> used only by customers) by checking every record with user's user type
> and assign the new id of customers table.
>
> My tables should looks like
>
> users table:
>
> id | name | ...
> ------------------------------
> 1 | aaa | ...
> 2 | bbb | ...
> 4 | ddd | ...
> 6 | fff | ...
>
> customers table
>
> id | name | ...
> -------------------------------
> 3 | ccc | ...
> 5 | eee | ...
> 7 | ggg | ...
>
> When i'm migrating users existing data, I can't assign the id of user as
> customer's primary id

Well, what you can't do is use "mass assigment" to set the id of an ActiveRecord model.

You can, however, set the id on a new record and it will be honored if the database doesn't forbid it. (For example, if that primary key value already existed.)

>
> In my migration file
>
> def up
> create_table(:customers) do |t|
> t.string :name
> end
>
> User.joins(:user_type).where(:user_type => {:type_name =>
> 'customer'}).find_in_batches(:batch_size => 100){ |users|
> users.each {|user|
> customer = Customer.new
> customer.id = user.id
> customer.name = user.name
> customer.save(:validate => false)
> }
> }
> end
>
> Also tried
>
> Customer.create!(:id => user.id) instead of save method
>
> And
>
> INSERT INTO customers(id, name) VALUES("#{user.id}", "#{user.name}")
>
> Finally all ended with same error
>
> Error: Called id for nil, which would mistakenly be 4 -- if you really
> wanted
> the id of nil, use object_id
>
> Is this correct?
>
> Is there any way to assign the primary id ?
>
> Please anyone explain how to do this?

There's even a block form of ActiveRecord.new that passes in the newly initialized object.

customer = Customer.new(:name => user.name) {|c| c.id = user.id }
customer.save(:validate => false)

Since you already have a "user_type", it seems like you're at least halfway to being STI (Single-Table Inheritance) anyway.

Couldn't you have:

class Customer < User
end

Then you'd have a `type` attribute (column) in the users table which would hold the class name represented by that row of data. (which could be "User" or could be "Customer")

Then you can say:
r = User.find_by_name('ccc')
and r will hold an instance of the Customer class.

-Rob

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

Ruby on Rails

I'm migrating an app from rail 2 to rails 3 and hitting several instances of strings that need to be code html_safe to prevent the default processing from breaking the html.  Are there tools or techniques to easily identify all such instances in the source code or is the only option to discover each instance one at a time?  Thanks

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+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/msg/rubyonrails-talk/-/IK9pWwD8b58J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

We are Wimdu, a cool start-up headquartered in the heart of Berlin.
Initially funded with $90 million, Wimdu has grown to host over 50,000
properties in over 100 countries worldwide, and is on track to become
Europe's leading marketplace for private accommodation. Wimdu has the
vision, the passion, and the people to succeed, and we're looking for
motivated folks to join our international crew.

For our IT Team in Berlin we are looking for a Ruby on Rails Intern:
Are you passionate about programming ? Do you enjoy working in an
international environment and contributing to the overall objective of
delivering well-designed and coded applications or application
enhancements? Then join our IT-team and work next to our talented RoR
Developers.

Your Tasks:
• You acquire and maintain current knowledge of Ruby on Rails
• You code and work on projects which will lead to sophisticated backend
and frontend solutions
• Your work will substantially benefit our internet platform and improve
our User Experience
• You will code additional features and enhancements using test-driven
development methods
• You will actively participate in an extremely agile development
process with daily releases

Your Profile:
• You study Information Science, Management Information Systems or a
related field
• You are passionate about programming, and enjoy TDD in an agile
environment
• You are familiar with XHTML, HTML5, CSS, JavaScript, and jQuery
• You ideally have already gained experience with developing
applications like RoR, Python, Java, .Net or PHP
• You are a quick learner, and have strong analytical and problem
solving skills
• You are an excellent communicator and love working in a team

Our Offer:
If you seek an exciting opportunity to get some real-world developer
experience, working for one of Germany's most successful internet
startups, then we are looking for you! As a Ruby on Rails Intern you
will have the opportunity to experience test-driven and agile
development on one of the biggest Ruby projects in Europe.

We offer international startup-spirit based in a converted warehouse in
the heart of Germany´s capital. The Wimdu Academy, monthly events, and a
chill-out area complete our offer and will enrich your days as a part of
our fantastic team. Furthermore, you will have the opportunity to obtain
a hands-on experience in a new, rapidly growing company, benefiting from
a highly-motivated team, flat hierarchies and flexible structures.

Excited by the prospect of joining us?
Please forward your application, mentioning your earliest starting date,
by using the following link:

http://hire.jobvite.com/j/?aj=ozT3Wfwb&s=www.ruby-forum.com

Ciao!

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

Ruby on Rails

On Thu, Jan 31, 2013 at 7:45 AM, Mark Nongkhlaw
<mark.nongkhlaw@gmail.com> wrote:
> I tried running msconfig, chose selective startup, then rebooted.
> Thereafter, I could browse with IE, Firefox, but once I stop browsing for a
> while, and then try again, they fail again.

So your system is basically broken. Seriously, I think it's time for an
OS reinstall - preferably with some version of Linux :-)

Unless you can find someone who knows Windows who can help
you troubleshoot this, but that's not me; sorry!

Best of luck, though.
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

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

Ruby on Rails

Note: the original post is older than 6 months. Please don't ask any new
questions in this thread, but start a new one.

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

Ruby on Rails

On 31 January 2013 16:01, Nishan T. <lists@ruby-forum.com> wrote:
> I'm migrating the tables with existing data
> I've users table and all other tables contains the user_id column and
> now i need seperate the users into two (users & customers) tables
> So i need to migrate the new customers table with existing users records
> where the user type with customer

Are you sure you want to do it that way? It may well be simpler to
keep one table with flags to indicate the type of the user.
Alternatively you could use STI (though again this may be more complex
than just flags). Also there is the cancan gem that allows users to
have various roles (user and customer in this case). Remember that
you can have multiple relationships between the same tables with
different association names for the different cases. Also remember
that you can have self-referential associations so that if you want
relationships between users and customers that can still be done even
if they are in the same table. See the Rails Guide on ActiveRecord
Associations.

If you can't see how this would work post the proposed relationships
between users, customers and the rest for suggestions on how to
achieve the same thing with a single table.

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

Ruby on Rails

I don't think you use the assets part of the path in Rails 3.1+. Try it with just /videos/video.mov and see what happens then.

Walter

On Jan 31, 2013, at 7:31 AM, Maddy wrote:

> Hi Folks,
>
> I want play videos, the src file should i get from assets/videos.
>
> I just created one folder in my assets like videos and placed one .mov file.
>
> In my view,
>
> <video width="320" height="240" controls="controls">
> <source src="/assets/videos/demo.mov" type="video/mov" />
> Your browser does not support the video tag.
> </video>
>
> But its not working. Please advice.
>
> --
> 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/msg/rubyonrails-talk/-/TygyXNbguhoJ.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

I am converting/migrating an app from rails 2 to rails 3.  Along with other things that must be changed, I am encountering scattered instances of string literals and strings returned by helpers in templates that are being automatically html escaped on rails 3.  Are there any tools or techniques to identify and perhaps automatically correct these instances or is continuing to find them piecemeal the only way to proceed?  Thanks

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+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/msg/rubyonrails-talk/-/hyhLu45L53kJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

I'm migrating the tables with existing data
I've users table and all other tables contains the user_id column and
now i need seperate the users into two (users & customers) tables
So i need to migrate the new customers table with existing users records
where the user type with customer

I need to create a customers table and set the id of users records with
user type as customer,
which will be easy instead of migrating many of other tables(which is
used only by customers) by checking every record with user's user type
and assign the new id of customers table.

My tables should looks like

users table:

id | name | ...
------------------------------
1 | aaa | ...
2 | bbb | ...
4 | ddd | ...
6 | fff | ...

customers table

id | name | ...
-------------------------------
3 | ccc | ...
5 | eee | ...
7 | ggg | ...

When i'm migrating users existing data, I can't assign the id of user as
customer's primary id

In my migration file

def up
create_table(:customers) do |t|
t.string :name
end

User.joins(:user_type).where(:user_type => {:type_name =>
'customer'}).find_in_batches(:batch_size => 100){ |users|
users.each {|user|
customer = Customer.new
customer.id = user.id
customer.name = user.name
customer.save(:validate => false)
}
}
end

Also tried

Customer.create!(:id => user.id) instead of save method

And

INSERT INTO customers(id, name) VALUES("#{user.id}", "#{user.name}")

Finally all ended with same error

Error: Called id for nil, which would mistakenly be 4 -- if you really
wanted
the id of nil, use object_id

Is this correct?

Is there any way to assign the primary id ?

Please anyone explain how to do this?

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

Ruby on Rails

I tried running msconfig, chose selective startup, then rebooted. Thereafter, I could browse with IE, Firefox, but once I stop browsing for a while, and then try again, they fail again. No, I do not have a firewall. I'm very concerned as I have developed the rails app on the machine and desperately need to get the app back up and running. Can you tell me the name of the process that runs Webrick on Windows?

On Thursday, January 31, 2013 8:48:33 PM UTC+5:30, Hassan Schroeder wrote:

On Wed, Jan 30, 2013 at 8:44 PM, Mark N. <li...@ruby-forum.com> wrote:

> There was a sudden power outage and therefore Webrick couldn't be
> shutdown gracefully. On machine restart, I got the exact same error as
> Gordons, however, my Ruby is 1.8.7 and I'm on a WinXP machine.
> Additionally, I found that none of my browsers (IE/Firefox) can connect
> to any website.

?! It's been years since I've touched a Windows machine, but that
sounds like your system is totally b0rk3d. Do you have a firewall
of some sort that might be affecting networking?

Try using basic networking tools like ping, traceroute, telnet, etc.;
if your system crash was extremely ungraceful, you might have an
OS reinstall ahead of you...

Good luck,
--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

--
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/msg/rubyonrails-talk/-/rwBwZQjlazUJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Today i've tried to update a site because of the latest security
problems.
But this older app breaks as soon i install anything newer than 2.3.5

When switching to 2.3.6 or later in environment.rb (same with the latest
2.3.16) everything gets rendered as text/plain so all i see is the html
source (which is supposed to be UTF-8) as ISO-8859-1.

I'm also not seeing any errors in the logs nor on console.
At most i get some deprecation warnings about rake tasks in
vender/plugin.

What could cause such a weird behavior?
Does anyone know?

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

Ruby on Rails

On Wed, Jan 30, 2013 at 8:44 PM, Mark N. <lists@ruby-forum.com> wrote:

> There was a sudden power outage and therefore Webrick couldn't be
> shutdown gracefully. On machine restart, I got the exact same error as
> Gordons, however, my Ruby is 1.8.7 and I'm on a WinXP machine.
> Additionally, I found that none of my browsers (IE/Firefox) can connect
> to any website.

?! It's been years since I've touched a Windows machine, but that
sounds like your system is totally b0rk3d. Do you have a firewall
of some sort that might be affecting networking?

Try using basic networking tools like ping, traceroute, telnet, etc.;
if your system crash was extremely ungraceful, you might have an
OS reinstall ahead of you...

Good luck,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

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

Ruby on Rails


--
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/msg/rubyonrails-talk/-/Ce1KfjBGv4YJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

On 31 January 2013 13:55, Jim Ruther Nill <jvnill@gmail.com> wrote:
>
>
>
> On Thu, Jan 31, 2013 at 9:52 PM, Fabian Peter <lists@ruby-forum.com> wrote:
>>
>> Hello,
>>
>> I'm trying to join 2 tables with ruby on rails 3.2.
>>
>> rails generate model product name:string
>> rails generate model price product_id:integer price:integer
>> date:datetime
>>
>> product.rb:
>> class Product < ActiveRecord::Base
>> has_many :prices
>> end
>>
>> price.rb:
>> class Price < ActiveRecord::Base
>> belongs_to :product
>> end
>>
>> What is the most efficient way to get all products including the latest
>> price into the View.
>>
>> Some tries didnt work for this:
>>
>> @test = Product.includes(:prices).all
>> I didnt find anything about the prices in @test.
>
>
> @test contains an array of products. to get the prices, try
>
> @test.each do |product|
> product.prices.each do |price|
> p price.price
> end
> end

But you don't need .includes,
@test = Product.all
will work fine (though I would prefer @products =Product.all since
that is what they are).

If you inspect @test you will not see the prices, but as soon as you
ask for the prices it will fetch them. Such is the magic or Rails.

I am sure readers here are bored with me suggesting to beginners that
they work right through a good tutorial such as railstutorial.org,
which is free to use online, but it is definitely a good idea as it
would give you a good introduction to the basics of rails. Also look
through the Rails Guides.

For some reason I am rarely thanked for offering this advice. :(

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

Ruby on Rails

Hi Saravanan,

Try below steps :

1. Download wicked pdf file
if your machine is 64 bit
http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-amd64.tar.bz2

if your machine is 32 bit
http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-i386.tar.bz2


2. cd /usr/local/bin
extract the zipped file inside /usr/loca/bin folder using command

if your prodcution machine is 32 bit tar -xvjf
wkhtmltopdf-0.9.9-static-i386.tar.bz2
if your machine is 64 bit tar -xvjf wkhtmltopdf-0.9.9-static-amd64.tar.bz2


3.if your machine is 32 bit sudo mv wkhtmltopdf-0.9.9-static-i386 wkhtmltopdf
if your machine is 64 bit sudo mv wkhtmltopdf-0.9.9-static-amd64
wkhtmltopdf

4. vi project_folder/vendor/plugin/wickedpdf/lib/wicked_pdf.rb
in the method def pdf_from_string

add a line i.e (setting a path) @exe_path="/usr/local/bin/wickedpdf"
b4 the line command ="#{@exe_path}................etc "

Regards
Mehdi


sudo mv
4.



On 1/31/13, Saravanan P <saravanan.p@shriramits.com> wrote:
> Hello everyone,
>
> I am using rails -v 3.2.8.
> I am using wickedpdf to generate pdf. Its working well in my local machine.
> But its not working in production server.
>
> ompleted 500 Internal Server Error in 4443ms
>
> RuntimeError (Failed to execute:
> "/var/www/apps/staging/shared/bundle/ruby/1.9.1/bin/wkhtmltopdf" -q
> "file:///tmp/wicked_pdf_5855_0.html"
> "/tmp/wicked_pdf_generated_file_5855_0.pdf"
> Error: PDF could not be generated!):
>
>
> Any Idea!
>
> Thank You
>
> --
> 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/msg/rubyonrails-talk/-/ZSuCLxrVp8kJ.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Thanks, but no, it is for the wrong version of rails.  This post has the solution to my problem:

http://stackoverflow.com/questions/13042201/exception-notification-gem-raises-actionviewtemplateerror-code-converter-no

On Wednesday, January 30, 2013 4:06:08 PM UTC-5, Colin Law wrote:

On 30 January 2013 18:57, jsnark <s...@monmouth.com> wrote:
> Ever since I upgraded my applications to rails 3.0.19 due to the security
> issue with older versions, exception notification has stopped working.  What
> is the fix for this problem?  Thank you.
>
> Rendered
> /var/www/rails/xxx/shared/bundle/ruby/1.9.1/gems/exception_notification-3.0.0/lib/exception_notifier/views/exception_notifier/exception_notification.text.erb
> (95.5ms)
>
> ActionView::Template::Error (code converter not found (UTF-8 to UTF-16)):
>     19:         [title, summary.gsub(/^/, "  "), nil].join("\n\n")
>     20:       end
>     21:     end.join
>     22:     sections = sections.force_encoding('UTF-8').encode('UTF-16',
> :invalid => :replace).encode('UTF-8') if
> sections.respond_to?(:force_encoding)
>     23: %>
>     24:
>     25: <%= raw sections %>

Does this help [1].  Google found it very quickly.

Colin

[1] http://stackoverflow.com/questions/13061836/getting-this-error-in-rails-actionviewtemplateerror-code-converter-not-fo

--
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/msg/rubyonrails-talk/-/LI0NhQX5XfgJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails




On Thu, Jan 31, 2013 at 9:52 PM, Fabian Peter <lists@ruby-forum.com> wrote:
Hello,

I'm trying to join 2 tables with ruby on rails 3.2.

rails generate model product name:string
rails generate model price product_id:integer price:integer
date:datetime

product.rb:
class Product < ActiveRecord::Base
  has_many :prices
end

price.rb:
class Price < ActiveRecord::Base
  belongs_to :product
end

What is the most efficient way to get all products including the latest
price into the View.

Some tries didnt work for this:

@test = Product.includes(:prices).all
I didnt find anything about the prices in @test.

@test contains an array of products.  to get the prices, try

@test.each do |product|
  product.prices.each do |price|
    p price.price
  end
end 
 

Thanks for help!

Fabian

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





--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Hello,

I'm trying to join 2 tables with ruby on rails 3.2.

rails generate model product name:string
rails generate model price product_id:integer price:integer
date:datetime

product.rb:
class Product < ActiveRecord::Base
has_many :prices
end

price.rb:
class Price < ActiveRecord::Base
belongs_to :product
end

What is the most efficient way to get all products including the latest
price into the View.

Some tries didnt work for this:

@test = Product.includes(:prices).all
I didnt find anything about the prices in @test.

Thanks for help!

Fabian

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

Ruby on Rails

Hi Jon,


I have a similar situation. Do you have a solution yet? I already have a user created and want to only add a profile image. It seems that the success_action_redirect performs a get but I would like to actually perform a post to create a record for that image. 

Tad

On Monday, September 3, 2012 4:53:44 PM UTC-5, Jon wrote:
I posted this on StackOverflow, and didn't get much love.  I'm hoping someone here can help me.  Thanks in advance!
 
I have a form that displays information about a single commercial real estate property. I am trying to create a feature on it that allows the user to upload files to Amazon S3 that will then be associated with that property. In a separate question, I asked how this relationship should work. I have a series of questions about this whole thing, but it seems that Stack Overflow likes to keep each question limited to a specific topic.

I've created a relationship so that Properties has_many Uploadedfiles and Uploadedfiles belongs_to Properties. I added a column to the Uploadedfile table called "uploaded_file" and mounted CarrierWave to that column

I've read through the Readme and Wiki for Carrierwave and Carrierwave_direct. They both talk about adding a single Avatar to a new User, when that new User is created. In my case, the property is already created, and I want to be able to upload multiple files (one at a time, for now) to that Property. (later, I will add a feature that lists out links to each of the uploaded files so that the user can download and open them).

Here is what the readme says. What do I need to do in my controllers and views to make this work for me?

Rails

If you are using Rails and you've mounted your uploader like this:

class User < ActiveRecord::Base     mount_uploader :avatar, AvatarUploader   end   

things just got a whole lot easier. You can generate a direct upload form like this:

class AvatarController < ApplicationController     def new       @uploader = User.new.avatar       @uploader.success_action_redirect = new_user_url     end   end      <%= direct_upload_form_for @uploader do |f| %>     <%= f.file_field :avatar %>     <%= f.submit %>   <% end %>   

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+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/msg/rubyonrails-talk/-/Pud7U2dZJCEJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Hi Folks,


I want play videos, the src file should i get from assets/videos.

I just created one folder in my assets like videos and placed one .mov file.

In my view,

<video width="320" height="240" controls="controls">
  <source src="/assets/videos/demo.mov" type="video/mov" />
   Your browser does not support the video tag.
</video>

But its not working. Please advice.

--
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/msg/rubyonrails-talk/-/TygyXNbguhoJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Colin Law wrote in post #1094550:
> On 31 January 2013 11:56, manoj c. <lists@ruby-forum.com> wrote:
>> yes i meant select_tag only like below example
>> <%=select_tag "people", "<option>David</option>".html_safe%>
>>
>> But here name and id of select_tag is same(people), i want to know how
>> to give it seprately
>
> OK, I understand. I don't know of a way to do that. Why do you need
> it?
>
> Colin

:( ok its a need now as to do some operation in ajax

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

Ruby on Rails

On 31 January 2013 11:56, manoj c. <lists@ruby-forum.com> wrote:
> yes i meant select_tag only like below example
> <%=select_tag "people", "<option>David</option>".html_safe%>
>
> But here name and id of select_tag is same(people), i want to know how
> to give it seprately

OK, I understand. I don't know of a way to do that. Why do you need 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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

yes i meant select_tag only like below example
<%=select_tag "people", "<option>David</option>".html_safe%>



But here name and id of select_tag is same(people), i want to know how
to give it seprately



Thanks
Manoj.

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

Ruby on Rails

On 31 January 2013 11:41, manoj c. <lists@ruby-forum.com> wrote:
> Hi anybody please give me example to write select_tag with id, name and
> options,
> :note => here id and name of my select tag are different.

First have a look at the docs and then come back with your best atempt
and explain what does not work about it.
However, are you sure you want to use select_tag rather than using
form_for and f.select? There are occasions when using form_tag and
select_tag is appropriate but if possible then use form_for.

If you have not already done so then work right through a tutorial
such as railstutorial.org which is free to use online and will show
you the basics of rails.

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

Ruby on Rails

Hi anybody please give me example to write select_tag with id, name and
options,
:note => here id and name of my select tag are different.





Regards and Thanks in advance
Manoj.

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

Ruby on Rails

On 31 January 2013 10:42, Roger McDonald <lists@ruby-forum.com> wrote:
> Being new to rails and ruby I'm a bit lost.
>
> Have a data entry scaffold, Details, which has name, string,
> cost1:integer cost2:integer cost3: Total:integer
> The user inputs puts a value into each of 3 fields.
>
> The totals field should ideally be automatically updated as each value
> is entered or changed. Then Save stores all 4 values into the database.
> One of the values cost3 should display a tax value of 10% of that
> particular entry beside the entry.
>
> Is this possible to do this or should I have something like a cart and
> display the calculations in that?

First don't store the total in the database, provide a method of the
model called total which works it out when you need it. If you store
it then you add all sorts of complications making sure you keep the
total correct when you change the other fields, and there is no need
to add the complexity.

Second, if you want the total and tax value displayed on screen as
they are entered then that must be done by javascript so that is not a
RoR issue. Some tutorials on javascript and probably jQuery are in
order.

>
> I have read the Agile Web Development books, Enterprise Recipes,
> Advanced Rails, Why's Poignant, Head First Rails which is for rails2 so
> some scripts fail.
> None explain how to do some of the more simple things like the above or
> taking a value from a select list and using it to update a field in
> another view.

I don't understand what you mean by the last sentence.

If you have not been able to work right through a tutorial so far then
I suggest railstutorial.org which is free to use online. There is
nothing like actually working through a tutorial, doing the exercises
and so on, to get a grasp of the basics.

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

Ruby on Rails

Being new to rails and ruby I'm a bit lost.

Have a data entry scaffold, Details, which has name, string,
cost1:integer cost2:integer cost3: Total:integer
The user inputs puts a value into each of 3 fields.

The totals field should ideally be automatically updated as each value
is entered or changed. Then Save stores all 4 values into the database.
One of the values cost3 should display a tax value of 10% of that
particular entry beside the entry.

Is this possible to do this or should I have something like a cart and
display the calculations in that?

I have read the Agile Web Development books, Enterprise Recipes,
Advanced Rails, Why's Poignant, Head First Rails which is for rails2 so
some scripts fail.
None explain how to do some of the more simple things like the above or
taking a value from a select list and using it to update a field in
another view.
I've been searching for days with no luck,
Thank you in advance
R

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

Ruby on Rails

On 30 January 2013 23:08, oto iashvili <optimum.dulopin@laposte.net> wrote:
> hi
>
> thanks for answer sorry I quite new in RoR. If I do how u said, will I have
> to validate "manually" all the attributes for details ?

If you are new to rails there are probably many other basic features
that you are not aware of. I suggest you work right through a good
rails tutorial such as railstutorial.org, which is free to use online.
That will introduce you to the basics. Also look through the Rails
Guides, the one called Active Record Validations and Callbacks should
cover what you are looking for. Also look through the others.

Colin

>
> Le mercredi 30 janvier 2013 15:27:43 UTC+1, jim a écrit :
>>
>>
>> On Wed, Jan 30, 2013 at 6:48 PM, oto iashvili <optimum...@laposte.net>
>> wrote:
>>>
>>> I want to do
>>> @ad = Ad.attributes(params[:ad])
>>> maybe Im wrong, but as I understood about polymorphic in rails, this
>>> would thow an error say that ad_real_estate_details does not exist
>>>
>>> as they explained here
>>> http://stackoverflow.com/questions/3969025/accepts-nested-attributes-for-with-belongs-to-polymorphic
>>
>>
>> As I've said, don't use accepts_nested_attributes_for. Create a getter
>> and setter method for each kind of details that you want.
>> If you don't want to do that, create an attr_accessor for the details, and
>> create the detail record in a callback.
>>
>>
>>>
>>>
>>>
>>> Le mardi 29 janvier 2013 13:39:18 UTC+1, jim a écrit :
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, Jan 29, 2013 at 7:41 PM, oto iashvili <optimum...@laposte.net>
>>>> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> thanks for answer. My pb with polymorphic is that I would have to
>>>>> create first in db a ligne for ad_real_estate_details and then create my ad,
>>>>> what is non sense for me, in terms of logic.
>>>>> and it might brings some pb as I read there
>>>>> http://stackoverflow.com/questions/3969025/accepts-nested-attributes-for-with-belongs-to-polymorphic
>>>>>
>>>>> lets have another example which is almost the same
>>>>>
>>>>> image we have Student (age, classe, ...) and Teacher (subject_taught)
>>>>> classes that inherit from User classes. I would be non sense to create first
>>>>> a Teacher entity, and then to link it to User, no ?
>>>>
>>>>
>>>> Why are you thinking of creating the details first? Why not create the
>>>> ad first, then add the details later? Sometimes,
>>>> accepts_nested_attributes_for is not always the answer for creating
>>>> association records. Try to look into virtual attributes
>>>> and callbacks.
>>>>
>>>>>
>>>>>
>>>>>
>>>>> Le lundi 28 janvier 2013 01:10:30 UTC+1, jim a écrit :
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Mon, Jan 28, 2013 at 6:27 AM, oto iashvili <optimum...@laposte.net>
>>>>>> wrote:
>>>>>>>
>>>>>>> hi,
>>>>>>>
>>>>>>> i' trying to re-create my project from php to rails. But now Im faced
>>>>>>> with a pb to witch I had solution with php, but I cant figure how to make it
>>>>>>> work with rails
>>>>>>>
>>>>>>> here my tables
>>>>>>>
>>>>>>> ads
>>>>>>> id
>>>>>>> category_id
>>>>>>> title
>>>>>>> text
>>>>>>>
>>>>>>> ad_real_estate_details
>>>>>>> id
>>>>>>> ad_id
>>>>>>> nb_room
>>>>>>> floor
>>>>>>>
>>>>>>> ad_car_details
>>>>>>> id
>>>>>>> ad_id
>>>>>>> color
>>>>>>> brand
>>>>>>>
>>>>>>> here what I succeed to do
>>>>>>>
>>>>>>>
>>>>>>> class Ad < ActiveRecord::Base
>>>>>>> attr_accessible :category_id :title, :text, :ad_real_estate_details
>>>>>>> has_one :ad_real_estate_details
>>>>>>> accepts_nested_attributes_for :ad_real_estate_details,
>>>>>>> allow_destroy: true
>>>>>>> end
>>>>>>>
>>>>>>> class AdRealEstateDetail < ActiveRecord::Base
>>>>>>> belongs_to :ad
>>>>>>> validates :ad_id, presence: true
>>>>>>> end
>>>>>>>
>>>>>>> but this only work for other category than real_estate
>>>>>>>
>>>>>>> so I was thinking of polymorphism, but polymorphism mean I should add
>>>>>>> a reference in my "ad" table to the detail tables, and remove annonce_id
>>>>>>> from detail tables , what I thing is non-sense as some ads can have no
>>>>>>> details, but details are non-sense without an ad.
>>>>>>
>>>>>>
>>>>>> i think you have it right when you mentioned using polymorphic
>>>>>> associations. it is fine to leave the polymorphic association
>>>>>> nil if the ad has no details if that's what you're worried about.
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I was also thinking of a class AdDetails, and AdRealEstateDetail
>>>>>>> would inherite from it, but this is not possible with rails as all
>>>>>>> subclasses will share the same table
>>>>>>>
>>>>>>> does anyone have a solution for this kind of problem ?
>>>>>>>
>>>>>>> thanks
>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Ruby on Rails: Talk" group.
>>>>>>> To post to this group, send email to rubyonra...@googlegroups.com.
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> rubyonrails-ta...@googlegroups.com.
>>>>>>>
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msg/rubyonrails-talk/-/GLpFbbHm0ogJ.
>>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> -------------------------------------------------------------
>>>>>> visit my blog at http://jimlabs.heroku.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-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/msg/rubyonrails-talk/-/zT4pri8N4GUJ.
>>>>>
>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> -------------------------------------------------------------
>>>> visit my blog at http://jimlabs.heroku.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-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/msg/rubyonrails-talk/-/DT2QhvrfLpUJ.
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>
>>
>>
>>
>> --
>> -------------------------------------------------------------
>> visit my blog at http://jimlabs.heroku.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/msg/rubyonrails-talk/-/fSjtYW_hRBEJ.
>
> 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.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails Wednesday, January 30, 2013

Thanks, Jordon. I already tried that, there's no Webrick or Ruby process listed.

Jordon Bedwell <envygeeks@...> writes:


> CTRL+SHIFT+ESC and search for webrick or ruby, right click, murder/kill





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

Ruby on Rails

On Wed, Jan 30, 2013 at 10:44 PM, Mark N. <lists@ruby-forum.com> wrote:
> There was a sudden power outage and therefore Webrick couldn't be
> shutdown gracefully. On machine restart, I got the exact same error as
> Gordons, however, my Ruby is 1.8.7 and I'm on a WinXP machine.
> Additionally, I found that none of my browsers (IE/Firefox) can connect
> to any website.
>
> I would be thankful if you can explain step-by-step how to find out
> whether another instance of Webrick is running and how to shut it down.
> Of course, I tried browsing to 127.0.0.1:3000, but my browsers have been
> affected, so the page cannot be displayed.

CTRL+SHIFT+ESC and search for webrick or ruby, right click, murder/kill

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

Ruby on Rails



hi dude i'm also new to ror, two days back i struggled for the same problem but in my case when i select an item from dropdown in my view. based on the selection another dropdown in the view should be update automatically without touching database...
  go to this site,see demo and view page source

   http://phrogz.net/tmp/selpopulate.html 
   
   this link wont provide the particular thing you have looking for but it it was done using javascript,hope it may give u an idea to solve ur problem.

--
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/msg/rubyonrails-talk/-/tz6B60VhmB8J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Hello everyone,


I am using rails -v 3.2.8.
I am using wickedpdf to generate pdf. Its working well in my local machine.
But its not working in production server.

ompleted 500 Internal Server Error in 4443ms

RuntimeError (Failed to execute:
"/var/www/apps/staging/shared/bundle/ruby/1.9.1/bin/wkhtmltopdf" -q        "file:///tmp/wicked_pdf_5855_0.html" "/tmp/wicked_pdf_generated_file_5855_0.pdf" 
Error: PDF could not be generated!):


Any Idea!

Thank You

--
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/msg/rubyonrails-talk/-/ZSuCLxrVp8kJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Hi Hassan,

There was a sudden power outage and therefore Webrick couldn't be
shutdown gracefully. On machine restart, I got the exact same error as
Gordons, however, my Ruby is 1.8.7 and I'm on a WinXP machine.
Additionally, I found that none of my browsers (IE/Firefox) can connect
to any website.

I would be thankful if you can explain step-by-step how to find out
whether another instance of Webrick is running and how to shut it down.
Of course, I tried browsing to 127.0.0.1:3000, but my browsers have been
affected, so the page cannot be displayed.

Thanks in advance.

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

Ruby on Rails


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

Ruby on Rails

Hey guys,

If you have time to read something today, please visit the latest entry on NetEngine's blog. http://netengine.com.au/blog/learning-while-conducting-the-triggerapp-upgrade/

This will grant me a case of beer if I gain at least 60 views today. hehe

Thanks!

--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Hi, Sam
I need a rails job which can work remotely, I have been using rails for 4+ years and i am located in +8 timezone.


-- 
rubyonrailsx
Sent with Sparrow

On Thursday, January 31, 2013 at 10:47 AM, Sam A. wrote:

Dear Members;

We are looking for ROR developers with our direct client in VA

Duration-24+Months

Any one interested please do reply

Sam
732-208-8319

--

--
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.

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

Ruby on Rails

Dear Members;

We are looking for ROR developers with our direct client in VA

Duration-24+Months

Any one interested please do reply

Sam
732-208-8319

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

Ruby on Rails

we have an onsite opurtunity with our direct client for 24+months

If intrested please do forward your profile to sam.alexander@marlabs.com

Sam
732-2088319





Sep D. wrote in post #1094090:
> Hi guys,
>
> I am looking for a job as a Ruby On Rails developer - remotely, as a
> part-time or full-time.
> My knowledge - 2,5 years programming in Ruby On Rails, further -
> knowledge of:
>
> MySQL, PostgreSQL, SQLite
> JS (jQuery, Coffeescript)
> HTML/HAML/Slim
> XML, JSON
> Heroku, Amazon
> Git
>
> I am available immediately.
>
>
> Thank you,
>
> Regards

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