Ruby on Rails Monday, April 30, 2012

I want to know if you a plugin or script that i can obtain the following
results:


day of born: 21/09/87
results: 24 years, 7 months, 20 days(moreless)

i know it should be a residual calculation but i am wondering if you
know or have seen a way through this.


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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I'm playing around with FLOT with Ruby and I'm having a hard time
passing the code to javascript; I know my javascript isn't reading the
data correctly from Ruby. I need some syntax help.

Ruby Code:

o={};
o= {'label' => "A", 'data' => @example.collect{|x|
[Time.utc(x.date).to_i, x.num]}}
render :text => o.to_json


I have successfully rendered the output as such:

{"label":"A","data":[[1281225600,1.31],[1281225600,1.31],[1281225600,1.25]]}

The HTML outputs this data only.




My javascript is as follows:


var obj = jQuery.parseJSON(text);
var options = {
lines: { show: true },
points: { show: true },
xaxis: { mode: "time", timeformat: "%m/%d/%y", minTickSize: [1,
"day"]}};

var data = obj;
$.plot(placeholder,[data],options);
}


I think the jQuery.parseJSON(text); isn't working. Any suggestions will
be helpful.

--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Leandro Facchinetti wrote in post #1058817:
> It's Ruby. If the last argument in a function call is a hash, you can
> omit
> the braces.

I think technically it has to do with ambiguity. It doesn't really have
anything do with it being the last argument, but rather omitting the
braces anywhere else in the argument list would cause ambiguity.
Although, that's really just semantics.

--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

masta Blasta wrote in post #1058719:
> I'm considering making every little piece of editable content on my site
> a model with it's own table.

Call it considered, then go build something sensible.

> So if you think of a blog post for example, the title, subject, body,
> whatever....would be a separate table. With the proper associations of
> course.

I think of a blog post (object) as having a title, subject, body,
whatever (attributes).

> The reason for this is to 1.) allow for special attributes to be
> assigned to each piece of content, 2.) to allow for each piece of
> content to be edited individually via ajax.

I'm sure there are other, simpler, ways to deal with these scenarios.

> You can think of it as making everything into a component/widget.

Not even systems based entirely on components/widgets carry this idea
all the way down to the model layer. Components/widgets are
view/controller layer concerns.

> My questions are:
> 1.) How much extra strain would this be on the database. So now instead
> of just fetching one row with the data, you would query each table
> association for the right info.

I would not expect many to consider this to be a "scalable" design.

> 2.) Does anyone have any good examples/tutorials for turning every piece
> of content on your site into an ajax editable component?

I'm not aware of any. But, there has to be a better way than what you
suggest. AJAX should not in any way dictate how the model layer persists
its data. It's the job of the controller and view to collect and arrange
the data for use by the model.

--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Jedrin wrote in post #1058661:
> We want to use SQL/active record for logging but limit the table size
> so that older messages disappear off of the table Some process has to
> run periodically to do that.

Here's something I discovered after posting my reply, but certainly
worth considering.

Do you logging with MongoDB instead of a SQL database. MongoDB has
built-in support for high performance logging scenarios:

See the following for more:
http://www.mongodb.org/display/DOCS/Capped+Collections

--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Marcos Serpa wrote in post #1058999:
> I'm searching for days, but I'm not finding a way to do this. How can I
> pass like an argument by 'link_to' the selected value of a selected_tag?
> Like this:
>
> <%= select_tag 'cities', options_from_collection_for_select(@cities,
> 'id',
> 'city') %>
>
> <%= link_to "See", deals_path(:id => ??) %>
>
> Just to clarify, all the code below is working perfectly. I just don't
> know
> what I put in '??' on the ":id => ??" to pass the selected value of the
> select_tag.

Okay, the first thing to realize is that a selection made by the user
using a select control does not notify the server of any change. The
browser downloads the page. The user makes their selection and "posts"
the form back to the server. There is nothing you can do server-side to
detect the selection when it actually occurs.

You will need to handle this on the client side using JavaScript. There
are multiple ways to handle that. I'll leave that as an exercise for
you. If you have any specific questions during the implementation of
that then please ask.

--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails



On Mon, Apr 30, 2012 at 10:52 AM, Marcos Serpa <marcosserpa@gmail.com> wrote:

Hello, guys.

I'm searching for days, but I'm not finding a way to do this. How can I pass like an argument by 'link_to' the selected value of a selected_tag? Like this:

<%= select_tag 'cities', options_from_collection_for_select(@cities, 'id', 'city') %>

<%= link_to "See", deals_path(:id => ??) %>

Just to clarify, all the code below is working perfectly. I just don't know what I put in '??' on the ":id => ??" to pass the selected value of the select_tag.

To make easy in your minds, remember the Groupon site. The deals page. When you choose a place, then the deals showed to you is only the deals of that place. Exactly what I want...

OBS: This is not a form. Just an index page that show a list of things of the database.

Got this, guys? Can you help me?

Hug!


I guess that instead of a link_to, should be a form.

You should do a form_tag and inside that the selector, so when you click on the "View" button it will make a request of the selected option.
Now if you want to do all of that without "refreshing" the browser, you could do an ajax call and you have to add :remote=>true to your form_tag options

If you want to add the ID to that link (html) you will have to add some javascript in order to update the link value

JavierQ

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

If your strategy is to just keep the newest MAXNUMBER records you might consider just adding an after_create method to your model.

On Friday, April 27, 2012 4:56:30 PM UTC-4, Colin Law wrote:

On 27 April 2012 16:23, Jedrin <jrubiando@gmail.com> wrote:
>  We want to use SQL/active record for logging but limit the table size
> so that older messages disappear off of the table Some process has to
> run periodically to do that.
>
> Suppose I want to keep my table size to not much bigger than
> 50,000,000 rows or so. What is the easiest, most efficient way to
> delete any extra rows that there may be ? This is an SQL/active record
> problem I have not encountered before.
>
>  I would know in theory how to get all the records as an array by
> calling MyLog.find(:all) and ordering it by date and then iterating
> from where I want to chop off to the end and deleting each one, but
> that may not be the most efficient or acceptable way to do that.

If you have a reasonably consistent number of new records each day or
week or whatever then you could delete old ones by date rather than
count, so keeping six months worth of records for example.  This would
be much easier as you could just find the records where created_at is
before a given date and delete them.  Put an index on created_at
obviously.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/xzIqMB-OhlYJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

that makes sense, thanks

On Apr 30, 12:41 pm, Tim Shaffer <timshaffe...@gmail.com> wrote:
> id and class are built-in ruby methods that are present on all object
> instances.
>
> Rails uses them in a different manner than the default Ruby implementation.
>
> They are undefined so that they can be picked up by the method_missingmethod.

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On Sunday, April 29, 2012 7:51:38 AM UTC-3, Ruby-Forum.com User wrote:

Server starting failed (ruby 1.9.3p194, rails 3.2.3 )

Attachments:
http://www.ruby-forum.com/attachment/7346/ruby193err.txt


Please read the FAQ section that was mentioned with the release of RubyInstaller 1.9.3-p194:

https://groups.google.com/d/msg/rubyinstaller/nTcdd55fNiY/Mp-CitrdWkQJ

Will copy it here in case you don't see it:

= Q: What means by "increased file descriptors", how that affects me?

A: By default Ruby 1.9 was limited to 64 sockets when using select() function.
select() is a mechanism to set and clear the state of sockets that are waiting
for data. In other OS you have different 'pooling' mechanisms.

Most of the web servers that run on Ruby, specially the evented ones depends
on select().

Without this change these frameworks/libraries wouldn't be able to use more
than 64 open sockets, which affects any of us attempting to use Ruby on Windows
for more than testing things out.

Please note that this is a workaround to a bigger issue: select() and the
associated functions are not the recommended or optimally way to interact with
sockets on Windows.

If you encounter a problem running a pre-compiled evented library against this
build, please ask the library author to recompile with -DFD_SETSIZE=32767.

==

This will affect Thin because it uses EventMachine. Until that issue gets sorted out, you need to:

A) build locally EventMachine:

gem install eventmachine --pre --platform=ruby

B) Request the gem authors to release a gem with the flag updated

We are discussing the technical challenges to solve that at Ruby level:

http://bugs.ruby-lang.org/issues/6352

--
Luis Lavena

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/TdUXsp4IJK4J.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails


Hey there,

I'm looking for a person who can write technical article on RoR. Please note: your quality of writing has to be good enough to get published on Smashingmagazine (which means only experts who can write high quality can apply).

Please poke me if you think you can help here.

Thanks,
Neil

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/gflMDicYvZgJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hi there,

I'm doing an own library to manage datetimes depending on locales, to
deal with the formats of datetimes. I actually overrides the default
assign methods to made strptime.

I've made the following:

http://ideone.com/PXYl8

something is wrong when trying to access on I18n.t, the scope is valid,
if I put a debugger outside that misterious loop it prints what is
expected...

console output:

1.9.3p125 :001 > User.datepicker_attributes :created_at
=> [:created_at]
1.9.3p125 :002 > User.new.created_at = "10/10/2012 10:12"
=> "10/10/2012 10:12"
debugger outside the loop.
(rdb:1) p I18n.t('time.datepicker_formats').values.first
"%d/%m/%Y %H:%M"
(rdb:1) p Time.strptime(date,
I18n.t('time.datepicker_formats').values.first)
2012-10-10 10:12:00 +0200



I'm a little stuck on that, any tip will be appreciated

--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

id and class are built-in ruby methods that are present on all object instances.


Rails uses them in a different manner than the default Ruby implementation.

They are undefined so that they can be picked up by the method_missing method.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/KJ4aGP2TFHQJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I see something like this:

require "ostruct"
class OptionsWrapper < OpenStruct
undef :id, :class

def [](key)
send(key)
end

def []=(key, value)
send("#{key}=", value)
end

def method_missing(method, *args, &block)
return @table.include?(method) ? @table.send(method) : nil if
%w(id class).include?(method.to_s)

@table.respond_to?(method) ? @table.send(method, *args, &block) :
super
end
end

I know OpenStruct is a class part of standard ruby library allowing
you to arbitrarily create methods on an object instance. I know that
undef allows you to set a method to nil. But I dont see why it is
needed in this case.

thanks for response

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

yeah i was using rails 2 thanks for response

On Apr 22, 10:53 pm, Frederick Cheung <frederick.che...@gmail.com>
wrote:
> On Apr 23, 6:46 am, John Merlino <stoici...@aol.com> wrote:
>
>
>
>
>
>
>
>
>
> > Hey all,
>
> > I look at the rails documentation validation helpers:
>
> >http://api.rubyonrails.org/classes/ActiveModel/Validations/HelperMeth...
>
> > It has this example:
>
> > class Person < ActiveRecord::Base
> >   validates_inclusion_of :states, :in => lambda{ |person|
> > STATES[person.country] }
> > end
>
> > So basically when you update a record, thatobjectinstance is passed
> > into the lambda and validation occurs.
>
> The ability to specify a lambda as a validates_inclusion_of target was
> added in 3.x (not exactly sure which version - I think 3.1) and you're
> using 2.3.10, which doesn't have this ability. You'll probably need to
> write a custom validation, i.e. something along the lines of
>
> validate :check_screening_date
>
> def check_screening_date
>   if ...
>     errors.add(:screening, "screening must be between ...")
>   end
> end
>
> Fred
>
>
>
>
>
>
>
> > I try to emulate same thing:
>
> > class Subject < ActiveRecord::Base
> >   validates_inclusion_of :screening, :in => lambda { |subject|
> > (subject.screened_on + 7.days)..(subject.screened_on + 14.days) }
> > end
>
> > So basically I just want to make sure thedatethey entered is between
> > dates theobjectwas screend.
>
> > However, I get this error:
>
> > .rvm/gems/ruby-1.8.7-p357/gems/activerecord-2.3.10/lib/active_record/
> > validations.rb:908:in `validates_inclusion_of': Anobjectwith the
> > method include? is required must be supplied as the :in option of the
> > configuration hash (ArgumentError)
>
> > Ok so the source code shows this line:
>
> > enum = configuration[:in] || configuration[:within]
> > 607:
> > 608:         raise(ArgumentError, "Anobjectwith the method include?
> > is
> > required must be supplied as the :in option of the configuration
> > hash")
> > unless enum.respond_to?("include?")
>
> > Granted, a model instance does not have the include? method. So then
> > why does the example in the rails documentation work and what can I do
> > to emulate that?
>
> > thanks for response

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hello, guys.

I'm searching for days, but I'm not finding a way to do this. How can I pass like an argument by 'link_to' the selected value of a selected_tag? Like this:

<%= select_tag 'cities', options_from_collection_for_select(@cities, 'id', 'city') %>

<%= link_to "See", deals_path(:id => ??) %>

Just to clarify, all the code below is working perfectly. I just don't know what I put in '??' on the ":id => ??" to pass the selected value of the select_tag.

To make easy in your minds, remember the Groupon site. The deals page. When you choose a place, then the deals showed to you is only the deals of that place. Exactly what I want...

OBS: This is not a form. Just an index page that show a list of things of the database.

Got this, guys? Can you help me?

Hug!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/fECCwFx5SNwJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hi!


This RailsCast is a little bit older (Rails 3 has a new syntax for routes) but the idea remains the same:


Use a catch all route...

Best Regards,

Everaldo

On Mon, Apr 30, 2012 at 12:43 PM, Javier Quarite <jquarites@gmail.com> wrote:


On Mon, Apr 30, 2012 at 10:21 AM, Nike Mike <lists@ruby-forum.com> wrote:
How to create routes dynamically on rails 3.

Could you give an example of what you're trying to achieve?

Javier Q 

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails



On Mon, Apr 30, 2012 at 10:21 AM, Nike Mike <lists@ruby-forum.com> wrote:
How to create routes dynamically on rails 3.

Could you give an example of what you're trying to achieve?

Javier Q 

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hello everyone,

I'm upgrading one application from Rails 3.1.3 to 3.2.3 and run into a
nasty problem that none of the assets are found (everything worked
great before upgrade). I've investigated for several hours and it
seems that the root of the problem is that the order of initializers
becomes wrong after initializers.tsort (in railties-3.2.3/lib/rails/
initializable.rb:54). It seems that finisher_hook initializer (which
runs after_initialize, which then bootstraps sprockets by copying
paths from config.assets.paths to Rails.application.assets.paths) is
run before append_assets_path (which loads asset paths from all
engines) and so Sprockets is bootstrapped with empty list of asset
paths. Maybe anyone has any ideas where could the problem be and how
to solve it?

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

How to create routes dynamically on rails 3.

--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On 30 April 2012 13:23, Amir Z. <lists@ruby-forum.com> wrote:
>> Have you got the spaces at the front of the nested lines?
>>
>> Copy and paste the file here.
>>
>> Colin
>
> Dear Colin below is yml file.
>
> # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
>
> valid_user:
> id: 1
> screen_name: foobar
> email: foobar@gmail.com
> password: foobar
> authorization_token: 1
>
> invalid_user:
> id: 2
> screen_name: time
> email: tim@tim.com
> password: time
> authorization_token: 2
>
> Please let me know where I am wrong.

I don't know how many times in this thread I have pointed out that you
need spaces in front of the nested lines. In fact in my very first
reply I posted:

yml is very strict about formatting. You need spaces at the front of
nested lines, so
valid_user:
id: 1
screen_name: foobar
email: foobar@gmail.com
password: foobar
remember_me:
authorization_token: 1

Note the spaces in front of id:, screen_name: and so on.

Also note the first line of the file you posted, it gives you a link
to find out more. Did you go and look at that?

Colin

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I am working with Agile Web Development Book. I create complete app but
when I am trying to test my first unit testing. Its showing following
error.


1) Error:
test_truth(ProductTest):
Errno::ENOENT: No such file or directory - rails.png
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:814:in `readlines'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:814:in `read_fixture_file'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:768:in `initialize'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:712:in `new'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:712:in `read_yaml_fixture_files'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:707:in `each'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:707:in `read_yaml_fixture_files'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:706:in `each'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:706:in `read_yaml_fixture_files'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:676:in `read_fixture_files'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:549:in `initialize'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:509:in `new'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:509:in `create_fixtures'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:508:in `map'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:508:in `create_fixtures'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/connection_adapters/mysql_adapter.rb:234:in
`disable_referential
_integrity'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:505:in `create_fixtures'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/base.rb:1198:in `silence'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:504:in `create_fixtures'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:1000:in `load_fixtures'
C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li
b/active_record/fixtures.rb:934:in `setup'

1 tests, 0 assertions, 0 failures, 1 errors

Please help me out. Your inputs and suggestions are welcome.

Thanks
Amir

--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

> Have you got the spaces at the front of the nested lines?
>
> Copy and paste the file here.
>
> Colin

Dear Colin below is yml file.

# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html

valid_user:
id: 1
screen_name: foobar
email: foobar@gmail.com
password: foobar
authorization_token: 1

invalid_user:
id: 2
screen_name: time
email: tim@tim.com
password: time
authorization_token: 2

Please let me know where I am wrong.

--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I am trying to access a data list from inside a gem code, how should I
set the file path ..

here is my gem file structure :

>> my_extension
--- my_extension.gemspec
--- Gemfile
--- Gemfile.lock
>> lib
>> my_extension
--- code_a.rb
--- code_b.rb
--- code_c.rb
--- my_extension.rb
>> my_data
--- data.yml

from inside code_a.rb, I am trying to load an array from the
data.yml : data = YAML::load(File.open("data.yml"))
how should I set the path ??

thanks for feedback

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

hi,
initially i used i devise as gem but now i want to use devise plugin
in my vender/plugin for my application
so i gave rails plugin install https://github.com/plataformatec/devise.git
after giving install plugin it has been downloaded fine,but now while
i was trying to run

rails s
=> Booting WEBrick
=> Rails 3.0.10 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/prabhu/clone/aiq26/devise_username/aisleiq/vendor/plugins/devise/
lib/devise/failure_app.rb:14:in `<class:FailureApp>': undefined method
`mounted_helpers' for #<ActionDispatch::Routing::RouteSet:0x9d86a2c>
(NoMethodError)
from /home/prabhu/clone/aiq26/devise_username/aisleiq/vendor/plugins/
devise/lib/devise/failure_app.rb:8:in `<module:Devise>'
from /home/prabhu/clone/aiq26/devise_username/aisleiq/vendor/plugins/
devise/lib/devise/failure_app.rb:3:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/devise-1.4.5/lib/devise.rb:
410:in `configure_warden!'
from /usr/local/lib/ruby/gems/1.9.1/gems/devise-1.4.5/lib/devise/
rails/routes.rb:9:in `finalize_with_devise!'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/
application.rb:128:in `block in reload_routes!'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.10/lib/
active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.10/lib/
active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.10/lib/
active_support/lazy_load_hooks.rb:26:in `on_load'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/
application.rb:128:in `reload_routes!'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/
application.rb:120:in `block in routes_reloader'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.10/lib/
active_support/file_update_checker.rb:32:in `call'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.10/lib/
active_support/file_update_checker.rb:32:in `execute_if_updated'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/
application/finisher.rb:51:in `block (2 levels) in <module:Finisher>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/
application/finisher.rb:52:in `call'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/
application/finisher.rb:52:in `block in <module:Finisher>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/
initializable.rb:25:in `instance_exec'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/
initializable.rb:25:in `run'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/
initializable.rb:50:in `block in run_initializers'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/
initializable.rb:49:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/
initializable.rb:49:in `run_initializers'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/
application.rb:134:in `initialize!'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/
application.rb:77:in `method_missing'
from /home/prabhu/clone/aiq26/devise_username/aisleiq/config/
environment.rb:6:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.10/lib/
active_support/dependencies.rb:239:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.10/lib/
active_support/dependencies.rb:239:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.10/lib/
active_support/dependencies.rb:225:in `block in load_dependency'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.10/lib/
active_support/dependencies.rb:593:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.10/lib/
active_support/dependencies.rb:225:in `load_dependency'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.10/lib/
active_support/dependencies.rb:239:in `require'
from /home/prabhu/clone/aiq26/devise_username/aisleiq/config.ru:3:in
`block in <main>'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.5/lib/rack/
builder.rb:46:in `instance_eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.5/lib/rack/
builder.rb:46:in `initialize'
from /home/prabhu/clone/aiq26/devise_username/aisleiq/config.ru:1:in
`new'
from /home/prabhu/clone/aiq26/devise_username/aisleiq/config.ru:1:in
`<main>'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.5/lib/rack/
builder.rb:35:in `eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.5/lib/rack/
builder.rb:35:in `parse_file'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.5/lib/rack/
server.rb:162:in `app'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.5/lib/rack/
server.rb:253:in `wrapped_app'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.5/lib/rack/
server.rb:204:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/
commands/server.rb:65:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/
commands.rb:30:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/
commands.rb:27:in `tap'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/
commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

above error appears,could any one provide me solution regarding this
mounted_helpers

thanks,
-pab

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

> Please don't top post, it makes it difficult to follow the thread.
> Insert your reply at appropriate point(s) in previous message.

Sorry about that. I will be careful.


>
> Is there a column user_id in the contributions table? You should have
> added one for the the belongs_to association.

I was thinking of id of User table (created by Devise) rather than the
'user_id' which are supposed to be attached to 'Contribution' table.
Stupid misunderstanding of mine ;)


> tutorials on Rails in order better to understand the basics of Rails.
> railstutorial.org is good and free to use online.

Thanks for the info.


soichi

--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On 30 April 2012 09:24, Soichi Ishida <lists@ruby-forum.com> wrote:

Please don't top post, it makes it difficult to follow the thread.
Insert your reply at appropriate point(s) in previous message. Thanks

> Thanks for your answer. but it gives a different error
>
> SQLite3::SQLException: no such column: contributions.user_id: SELECT
> "contributions".* FROM "contributions"  WHERE "contributions"."user_id"
> = 3
>
> Maybe the association is not properly set up?

Is there a column user_id in the contributions table? You should have
added one for the the belongs_to association.

I think it would be worth your while working right through some
tutorials on Rails in order better to understand the basics of Rails.
railstutorial.org is good and free to use online.

Colin

>
> soichi
>
> --
> 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 post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Thanks for your answer. but it gives a different error

SQLite3::SQLException: no such column: contributions.user_id: SELECT
"contributions".* FROM "contributions" WHERE "contributions"."user_id"
= 3

Maybe the association is not properly set up?

soichi

--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On 30 April 2012 09:03, Soichi Ishida <lists@ruby-forum.com> wrote:
> Rails 3.1.3
>
> I have tables
>
> User  => has_many :contribution

That should be :contributions, plural.

> Contribution => belongs_to :user
>
> in user.rb, I would like to define a method to compute the total
> contribution
> (sum of field 'price:integer' )
>
>  def total_contribution
>    @contributions = Contribution.find_all_by_user(self)

Just use
@contributions = self.contributions

Colin

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Rails 3.1.3

I have tables

User => has_many :contribution
Contribution => belongs_to :user

in user.rb, I would like to define a method to compute the total
contribution
(sum of field 'price:integer' )

def total_contribution
@contributions = Contribution.find_all_by_user(self)
total = 0
@contributions.each do |c|
if c.done
total += c.price
end
end
return total
end

"Contribution.find_all_by(self)" gives an error

undefined method `find_all_by' for

Is there any better way?

soichi

--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails Sunday, April 29, 2012

On Apr 29, 9:48 pm, Mohamad El-Husseini <husseini....@gmail.com>
wrote:
> I have User, Account, and Role models. Role stores the relationship type
> between Account and User.
>
> I know that *attr_accessible* should be blank in the Role model to prevent
> attackers from changing either the role type (owner,
> admin, moderator, subscriber), account, or user ids.
>
> But what if an admin wants to change a subscriber to a moderator? This
> would raise a mass assignment security exception:
>
> user = User.find(params[:id])
> role = user.roles.find_by_account_id(params[:account_id])
> role.type = "admin"

No it wouldn't. You can always to foo.bar = 'baz', whether or not the
bar attribute is accessible or not. What attr_accessible controls is
what would happen if you did

role.update_attributes(params[:role])

Fred


>
> How do I solve this? One way is to create a separate model to represent
> each role (owner, admin, moderator, subscriber) and use an STI type
> pattern. This lets me do:
>
> user = User.find(params[:id])
> user.moderatorship.build(account_id: params([:account_id])
>
> Tedious! I would have to create Onwership, Moderatorship, Subscribership,
> etc..., and have them inherit from Role. If I want to stick to a single
> Role model, how can I modify a role type without a having a mass assignment
> security flaw?
>
> Also, I would appreciate an answer to this: Should I use a User has_many
> roles (user can have a single record for each role type) or has_one role
> (user can only have one role record, which must be toggled if their role
> changes) pattern?
>
> Models:
>
> class User < ActiveRecord::Base
>   attr_accessible :name, :email
>
>   has_many :accounts, through: roles
> end
>
> class Account < ActiveRecord::Base
>   attr_accessible :title
>
>   belongs_to :user
> end
>
> class Role < ActiveRecord::Base
>   attr_accessible
> end

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

After doing my own research, it looks like I can approach this two ways:


1. Episode 237, Railscasts, Dynamic att_accessible, overriding mass_assignment_authorizer
2. I can use attr_accessible role, as: :admin

I would appreciate it if anyone can elaborate on the merits of either approach.


On Sunday, April 29, 2012 4:48:12 PM UTC-4, Mohamad El-Husseini wrote:
I have User, Account, and Role models. Role stores the relationship type between Account and User.

I know that attr_accessible should be blank in the Role model to prevent attackers from changing either the role type (owner, admin, moderator, subscriber), account, or user ids.

But what if an admin wants to change a subscriber to a moderator? This would raise a mass assignment security exception:

user = User.find(params[:id])
role = user.roles.find_by_account_id(params[:account_id])
role.type = "admin"

How do I solve this? One way is to create a separate model to represent each role (owner, admin, moderator, subscriber) and use an STI type pattern. This lets me do:

user = User.find(params[:id])
user.moderatorship.build(account_id: params([:account_id])

Tedious! I would have to create Onwership, Moderatorship, Subscribership, etc..., and have them inherit from Role. If I want to stick to a single Role model, how can I modify a role type without a having a mass assignment security flaw?

Also, I would appreciate an answer to this: Should I use a User has_many roles (user can have a single record for each role type) or has_one role (user can only have one role record, which must be toggled if their role changes) pattern?

Models:

class User < ActiveRecord::Base
  attr_accessible :name, :email

  has_many :accounts, through: roles
end

class Account < ActiveRecord::Base
  attr_accessible :title

  belongs_to :user
end

class Role < ActiveRecord::Base
  attr_accessible
end

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/lP97z64Gr8oJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I have User, Account, and Role models. Role stores the relationship type between Account and User.


I know that attr_accessible should be blank in the Role model to prevent attackers from changing either the role type (owner, admin, moderator, subscriber), account, or user ids.

But what if an admin wants to change a subscriber to a moderator? This would raise a mass assignment security exception:

user = User.find(params[:id])
role = user.roles.find_by_account_id(params[:account_id])
role.type = "admin"

How do I solve this? One way is to create a separate model to represent each role (owner, admin, moderator, subscriber) and use an STI type pattern. This lets me do:

user = User.find(params[:id])
user.moderatorship.build(account_id: params([:account_id])

Tedious! I would have to create Onwership, Moderatorship, Subscribership, etc..., and have them inherit from Role. If I want to stick to a single Role model, how can I modify a role type without a having a mass assignment security flaw?

Also, I would appreciate an answer to this: Should I use a User has_many roles (user can have a single record for each role type) or has_one role (user can only have one role record, which must be toggled if their role changes) pattern?

Models:

class User < ActiveRecord::Base
  attr_accessible :name, :email

  has_many :accounts, through: roles
end

class Account < ActiveRecord::Base
  attr_accessible :title

  belongs_to :user
end

class Role < ActiveRecord::Base
  attr_accessible
end

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/sEc1RkV7VisJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Hi guys,


I'm trying to do something that should be relatively simple. I have a site that posts to social sites. So far I have it posting to twitter with:
https://twitter.com/share?original_referer=http://localhost:3000/members/shared_from_twitt&text=Check%20out%20the%20new%20%23sxsw%20versus%20w/%20@rejectnation%20@thestashbox.com:%20Criterion%20DVDs%20&%20posters%20up%20for%20grabs%20all%20week!%20Use%20tsblovesfsr%20to%20sign%20up&url=.

That takes the user to twitter, posts the twit and redirects them back to my site.

I'm trying to do the same with Tumblr and it claims to have the same thing. Does anyone know if this is true? And if so, how do i access it?
Also, if Pinterest can post and redirect, please let me know

Thanks and Regards,
Bertly

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/e7QduCpo-OYJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On Apr 27, 4:09 pm, masta Blasta <li...@ruby-forum.com> wrote:
> I'm considering making every little piece of editable content on my site
> a model with it's own table.
>
> So if you think of a blog post for example, the title, subject, body,
> whatever....would be a separate table. With the proper associations of
> course.
>
> The reason for this is to 1.) allow for special attributes to be
> assigned to each piece of content, 2.) to allow for each piece of
> content to be edited individually via ajax.
>
> You can think of it as making everything into a component/widget.

Without a better reason, I would advise against "making everything a
model". For small applications, I doubt you would see a noticeable
difference in speed of the db.
>
> My questions are:
> 1.) How much extra strain would this be on the database. So now instead
> of just fetching one row with the data, you would query each table
> association for the right info.
>
> 2.) Does anyone have any good examples/tutorials for turning every piece
> of content on your site into an ajax editable component?
>
> --
> Posted viahttp://www.ruby-forum.com/.

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Server starting failed (ruby 1.9.3p194, rails 3.2.3 )

Attachments:
http://www.ruby-forum.com/attachment/7346/ruby193err.txt


--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails Saturday, April 28, 2012

-----------------------------------------------------------------------

kaushal kishor sharma wants to stay in better touch using some of
Google's coolest new
products.

If you already have Gmail or Google Talk, visit:
http://mail.google.com/mail/b-58f827966b-e5cafe9aad-aCXK4OtX4GFoqFuCz1Rp_b97jVc
You'll need to click this link to be able to chat with kaushal kishor sharma.

To get Gmail - a free email account from Google with over 7,500 megabytes of
storage - and chat with kaushal kishor sharma, visit:
http://mail.google.com/mail/a-58f827966b-e5cafe9aad-aCXK4OtX4GFoqFuCz1Rp_b97jVc

Gmail offers:
- Instant messaging right inside Gmail
- Powerful spam protection
- Built-in search for finding your messages and a helpful way of organizing
emails into "conversations"
- No pop-up ads or untargeted banners - just text ads and related information
that are relevant to the content of your messages

All this, and it's yours for free. But wait, there's more! By opening a Gmail
account, you also get access to Google Talk, Google's instant messaging
service:

http://www.google.com/talk/

Google Talk offers:
- Web-based chat that you can use anywhere, without a download
- A contact list that's synchronized with your Gmail account
- Free, high quality PC-to-PC voice calls when you download the Google Talk
client

We're working hard to add new features and make improvements, so we might also
ask for your comments and suggestions periodically. We appreciate your help in
making our products even better!

Thanks,
The Google Team

To learn more about Gmail and Google Talk, visit:
http://mail.google.com/mail/help/about.html
http://www.google.com/talk/about.html

(If clicking the URLs in this message does not work, copy and paste them into
the address bar of your browser).

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

[SOLVED] As I am now using Rails 3.2.3 , I should get rid of the gem
'turn' in my Gemfile ( group test )

group :test do
# Pretty printed test output
gem 'turn', :require => false <= should be deleted !!!
gem 'minitest'

thanks to myself

On Apr 28, 5:09 pm, Erwin <yves_duf...@mac.com> wrote:
> I am running the unit tests according to the doc; when failing I get a
> lot of error trace regarding  setup_and_teardown.rb
> why ? what's missing ?
>
> thanks for feedback
>
> ruby -Itest test/unit/area_test.rb
>
> Loaded Suite test,test/functional,test/performance,test/unit,test/unit/
> helpers
>
> Started at 2012-04-28 16:50:01 +0200 w/ seed 14004.
>
> AreaTest
>      FAIL (0:00:00.103) test_should_not_save_area_without_name
>           Saved the area without a name
>         @ test/unit/area_test.rb:10:in `block in <class:AreaTest>'
>           /Users/yves/.rvm/gems/ruby-1.9.3-p125@rails32/gems/
> activesupport-3.2.3/lib/active_support/testing/setup_and_teardown.rb:
> 35:in `block in run'
>           /Users/yves/.rvm/gems/ruby-1.9.3-p125@rails32/gems/
> activesupport-3.2.3/lib/active_support/callbacks.rb:425:in
> `_run__2008357061900762550__setup__2421286496846222409__callbacks'
>           /Users/yves/.rvm/gems/ruby-1.9.3-p125@rails32/gems/
> activesupport-3.2.3/lib/active_support/callbacks.rb:405:in
> `__run_callback'
>           /Users/yves/.rvm/gems/ruby-1.9.3-p125@rails32/gems/
> activesupport-3.2.3/lib/active_support/callbacks.rb:385:in
> `_run_setup_callbacks'

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On 28 April 2012 16:47, Rubyist Rohit <lists@ruby-forum.com> wrote:
> I am using the latest version.

Latest version of what? Since you have not quoted the previous
message we do not know what you are referring to. Ruby, Rails,
Rubygems, Railsinstaller, Windows, Ubuntu?
With 'latest versions' it is always a good idea to give an actual
version so that people finding the post in the future know which it
is, but also how do you know that it is the latest version?

Remember this is a mailing list (though you may be accessing it via a
forum like interface) so it is good practice to quote the previous
message.

Colin

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I am using the latest version.

--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I am running the unit tests according to the doc; when failing I get a
lot of error trace regarding setup_and_teardown.rb
why ? what's missing ?

thanks for feedback


ruby -Itest test/unit/area_test.rb

Loaded Suite test,test/functional,test/performance,test/unit,test/unit/
helpers

Started at 2012-04-28 16:50:01 +0200 w/ seed 14004.

AreaTest
FAIL (0:00:00.103) test_should_not_save_area_without_name
Saved the area without a name
@ test/unit/area_test.rb:10:in `block in <class:AreaTest>'
/Users/yves/.rvm/gems/ruby-1.9.3-p125@rails32/gems/
activesupport-3.2.3/lib/active_support/testing/setup_and_teardown.rb:
35:in `block in run'
/Users/yves/.rvm/gems/ruby-1.9.3-p125@rails32/gems/
activesupport-3.2.3/lib/active_support/callbacks.rb:425:in
`_run__2008357061900762550__setup__2421286496846222409__callbacks'
/Users/yves/.rvm/gems/ruby-1.9.3-p125@rails32/gems/
activesupport-3.2.3/lib/active_support/callbacks.rb:405:in
`__run_callback'
/Users/yves/.rvm/gems/ruby-1.9.3-p125@rails32/gems/
activesupport-3.2.3/lib/active_support/callbacks.rb:385:in
`_run_setup_callbacks'

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On Saturday, April 28, 2012 6:46:08 AM UTC-3, Ruby-Forum.com User wrote:

Please see the attached images.

I installed Ruby on a PC running Windows Server 2008 R2. I also
installed Rails and it worked.

Now I am doing the same on another PC with same OS, but it giving error
(see attached images).


If you used RubyInstaller releases of Ruby:

http://rubyinstaller.org/

These already include RubyGems.

The second error might be related to an old version of Ruby and RubyGems.

Since you don't say what version of Ruby are you using (which you can obtain with "ruby -v") I'm just guessing.

If you want to start with Rails on Windows it is recommended you use instead RailsInstaller as it contains everything ready to be used.

Regards
--
Luis Lavena 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/BR1E-GVlD6UJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Learnemy is hiring a full time Ruby on Rails developer and here are 6
reasons why you should apply:

- Learnemy has a purpose. http://www.blog.learnemy.com/kpi/
- You will be treated with respect, and like an adult.
- You get to make key decisions in the startup.
- You get a competitive salary.
- Flexible hours. I respect the maker's schedule.
- You get to operate like a founder but enjoy the stability of an
employee.


What is Learnemy?
Learnemy is an online marketplace that connects you with instructors
for anything you want to learn. It solves this problem:

"I want to learn how to bake pineapple tarts. But my budget is only
$30 and I don't want to travel far. I wonder who can teach me."

And it can be expanded to include anything – handstand,
cycling, clay sculpting, barista workshop, arduino,
picking up girls or building your own tv.

The beta application is launched three weeks ago and till date it has
good progress. With a full-time developer on board, the startup can
speed up its growth.

Learnemy is founded by a Founder Institute graduate.


What skills do I need?
- Well versed in Ruby on Rails 3
- Well versed in with Facebook and Paypal APIs.
- TDD
- Have experience with Amazon Web Services (EC2, S3)
- Able to deal with database administration such as MySQL and Postgres
- Somewhat familiar with front-end development with CSS and jQuery


For more information, please see http://www.blog.learnemy.com/come-work-on-learnemy/

If you are interested, please send your resume including expected
salary, a snippet of your best code and earliest date of availability
to elisha@learnemy.com.

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails



On Sat, Apr 28, 2012 at 4:46 AM, Rubyist Rohit <lists@ruby-forum.com> wrote:
Please see the attached images.

I installed Ruby on a PC running Windows Server 2008 R2. I also
installed Rails and it worked.

Now I am doing the same on another PC with same OS, but it giving error
(see attached images).

Attachments:
http://www.ruby-forum.com/attachment/7342/ruby_error.png
http://www.ruby-forum.com/attachment/7343/gem_rails_error.png



I'm not sure the way you're trying to install rails, but in windows I've used this


and it worked (but now I'm on linux)

Javier Q 

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Rohit - I'm pretty new to Ruby, but I installed on Windows using RAILSINSTALLER.ORG. Its pretty fast and easy... 

On Sat, Apr 28, 2012 at 3:16 PM, Rubyist Rohit <lists@ruby-forum.com> wrote:
Please see the attached images.

I installed Ruby on a PC running Windows Server 2008 R2. I also
installed Rails and it worked.

Now I am doing the same on another PC with same OS, but it giving error
(see attached images).

Attachments:
http://www.ruby-forum.com/attachment/7342/ruby_error.png
http://www.ruby-forum.com/attachment/7343/gem_rails_error.png


--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.


--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

Please see the attached images.

I installed Ruby on a PC running Windows Server 2008 R2. I also
installed Rails and it worked.

Now I am doing the same on another PC with same OS, but it giving error
(see attached images).

Attachments:
http://www.ruby-forum.com/attachment/7342/ruby_error.png
http://www.ruby-forum.com/attachment/7343/gem_rails_error.png


--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

If they are having financial difficulties and are struggling to stay afloat; I think you have your answer right there. Run away, keep your money in your pockets, salvage your source code on all projects and look for more solid support


There is a rails_admin gem that is open source, there's another called active_admin that is more extensible/customizable than rails_admin. But I've NEVER heard of an open source gem/project that is not possible to customize. It's just ruby code anyhow. They likely just don't know how.

No it's not a railskit; those railskits are just white-labeled starter projects and none of them resemble at all what you are talking about.

I don't know if the Ruby on Rails forum is really the appropriate place for your question, as it's really difficult to gauge you and your developers relationship with a limited amount of details. We don't know size/competence of the developers or any of your arrangements/requirements; $3000 for us would be about 3 days work. 

Best of luck to you. If you don't trust your developer, why do you continue to use them? Acquire the source and move on.



On Friday, April 27, 2012 2:28:26 PM UTC-6, Colin Law wrote:
On 27 April 2012 14:57, Emanresu <craiglbanks@gmail.com> wrote:
> Hi!
>
> I need some help, my partner and I have hired an app development
> company to create an iPhone app that allows shops to list their
> inventory and advertise their specials, there is also a back end admin
> website that shop owners can login to that allows them to update their
> inventory and specials. The admin website communicates directly with
> the iPhone app so that any changes made are shown on the app, pretty
> much in real time.  This admin site has been created using Ruby on
> Rails and is called "Rails Admin."
>
> When we originally gave the developers our brief with all the features
> and functions we required, the developers confirmed that we would be
> able to have it so that shop owners could make changes that affect 1
> or more of their shops, or all of them at once.  This would be done by
> having a super admin login where a shop owner could control changes
> for multiple shops at once and managers at individual shops would have
> a standard admin login with changes only affecting their shop.
>
> As the project progressed, the developers advised that due to the
> limitations of "Rails Admin" it would not be possible to have this
> functionality and that we would have to choose between having it so
> that any changes made to one shop would affect all shops under one
> login, or, having it so that any changes made would only affect
> individual shops (under one login) so that if there was a change that
> affected more than one shop then the change would need to be repeated
> for each shop one at time. They have advised that it was not possible
> to customize "Rails Admin" and that for us to have the desired
> flexibility that we required and originally requested they would need
> to have a new admin system built from scratch and we would be looking
> at a cost of 3 to 4 thousand dollars.
>
> Since this time they have expressed on numerous occasions that they
> have greatly underquoted on our project and they been under financial
> pressure to the point where they was not certain if they could
> continue their business.  They have now emailed us a quote to build a
> new admin site. The quote is for 13 thousand dollars but states that
> because they can use the design and css files from the current "Rails
> Admin" site it will reduce the price to 9 thousand dollars.
>
> What I am wanting help with is to know if they have purchased a Rails
> Kit (such as you might find on this link, http://railskits.com/ )
> called Rails Admin for our project, are these kits customizeable after
> purchase to add to, or modify any functionality within the Ruby on
> Rails framework?  It kind of sounds to me that he is just going to be
> adding the originally requested (and quoted on) functionality that he
> advised was not possible, to the admin site we currently have and
> charging us 9 thousand dollars to do it.

Possibly they are referring to https://github.com/sferik/rails_admin
which is free.  I have no knowledge of the details of this but I would
have thought it likely that any competent Rails programmer would have
little difficulty extending it in the way you want.  I wonder whether
in fact they have little knowledge of Rails and would prefer to do it
a different way rather than extend the existing system.

Why have you posted this again rather than continuing the previous
thread, where I think you did not respond to the suggestions made
then?  It is not good manners to completely ignore the help previously offered.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/kh-bxgMAiOIJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On 28 April 2012 08:00, Rubyist Rohit <lists@ruby-forum.com> wrote:
> I intentionally install using this option. Which folders and files are
> needed if I need to manually create them?

What option? You have not quoted the previous messages so no-one
knows what you mean without searching back through previous email
messages. Remember this is a mailing list not a forum.

To see what folders and files you need then run
rails new testapp
That will generate the basic files/folders that you need for a rails
application.

Then for a new app if you do not want to use rails new then just
replicate the folders and files that rails new testapp created.
Though why you do not want to use rails new (if I understand what you
are saying correctly) I can not imagine.

Colin

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.