Re: [Rails] Ruby on Rails to power 13,000 schools with 7million+ students in Kerala, India

2011-08-07 Thread Dhaval Mehta
thankx for informing us..

On Sun, Aug 7, 2011 at 7:51 PM, Unni Koroth  wrote:

> I don't know how many of you are already aware of the Opensource
> Project Fedena - http://www.projectfedena.org/
>
> Fedena is recently selected by Government of Kerala, India to automate
> 13,000 schools with 7million+ students. I guess it is one of the
> largest implementation of a Ruby on Rails code in education sector.
>
> The project is named as "Sampoorna" - http://sampoorna.itschool.gov.in/
> News -
> http://ibnlive.in.com/generalnewsfeed/news/digital-super-highway-connecting-schools-soon/760209.html
>
> This project is into the final stages and expect a huge fan-base of
> ROR in Kerala. The IT@School department of Government of Kerala is
> notable for its achievements related to supporting FOSS
> https://www.itschool.gov.in/achievements.php
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
*Regards,
Dhaval Mehta*

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



[Rails] Ruby on Rails to power 13,000 schools with 7million+ students in Kerala, India

2011-08-07 Thread Unni Koroth
I don't know how many of you are already aware of the Opensource
Project Fedena - http://www.projectfedena.org/

Fedena is recently selected by Government of Kerala, India to automate
13,000 schools with 7million+ students. I guess it is one of the
largest implementation of a Ruby on Rails code in education sector.

The project is named as "Sampoorna" - http://sampoorna.itschool.gov.in/
News - 
http://ibnlive.in.com/generalnewsfeed/news/digital-super-highway-connecting-schools-soon/760209.html

This project is into the final stages and expect a huge fan-base of
ROR in Kerala. The IT@School department of Government of Kerala is
notable for its achievements related to supporting FOSS
https://www.itschool.gov.in/achievements.php

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



Re: [Rails] Problem in migrating a database to Heroku

2011-08-07 Thread G S RAO
All problems are solved with Rake gem 0.9.2.. I followed these steps:

   - I installed gem install rake -v=0.9.2 (I had the 0.9.1 gem)
   - removed the 0.9.1 with gem uninstall rake -v=0.9.1
   - updated with bundle update
   -

   then the db:migrate showed a warning, WARNING: Global access to Rake DSL
   methods is deprecated. Please

   It was solved by adding the following to the Rake file.

   module ::YourApplicationName
 class Application

 include Rake::DSL
 end
   end



If the above code not working means u can specify the rake gem version in
your gem file
and run command, bundle install from command prompt.

may be it will solve the issue .



On 4 August 2011 13:42, SW Engineer  wrote:

> When trying to migrate a database to `Heroku`, I get the following
> (Provided that I'm using `gem 'sqlite3', '1.3.3'`:
>
>
>$ heroku rake db:migrate
>(in /app)
>rake aborted!
>uninitialized constant Rake::DSL
>/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'
>/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:8:in
> `skLib>'
>/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:6:in
> `ake>'
>/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:3:in
> `uired)>'
>/app/.bundle/gems/ruby/1.9.1/gems/rdoc-3.9.1/lib/rdoc/task.rb:37:in
> `require'
>/app/.bundle/gems/ruby/1.9.1/gems/rdoc-3.9.1/lib/rdoc/task.rb:37:in
> `red)>'
>
>  
> /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/tasks/documentation.r
>ake:2:in `require'
>
>  
> /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/tasks/documentation.r
>ake:2:in `'
>
>  /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/tasks.rb:15:in
> `load'
>
>
>  /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/tasks.rb:15:in
> `block
> in '
>/app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/tasks.rb:6:in
> `each'
>/app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/tasks.rb:6:in
> `required)>'
>
>  
> /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:215:in
> `require'
>
>  
> /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:215:in
> `initialize_tasks'
>
>  
> /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:139:in
> `load_tasks'
>
>  
> /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.9/lib/rails/application.rb:77:in
>`method_missing'
>/app/Rakefile:7:in `'
>/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2373:in `load'
>/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
>/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2007:in `block in
> load_rakefile'
>/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2058:in
> `standard_exception_handling'
>/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
>/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:1991:in `run'
>/usr/ruby1.9.2/bin/rake:31:in `'
>
> How can I solve this issue?
>
> Thanks.
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 

   G SubbaRao

   Cell:08970668850

   E-Mail:subbarao@gmail.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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: using bundler while developing a gem.

2011-08-07 Thread Danny Burkes
> What is a good strategy for dealing with this?

Unfortunately, the only strategy I've found is to vote for
https://github.com/carlhuda/bundler/issues/396

- D

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



Re: [Rails] PROBLEM WITH PAPERCLIP

2011-08-07 Thread Surya
try "rake routes" in your console and see if there is anything like: user
{:action => 'show', :controller => 'pictures'}

Here you don't have any issue with paperclip it seems!! its some routing
issue which is messing things up!

On Sun, Aug 7, 2011 at 7:10 PM, Annapoorna R  wrote:

> hello,
>
> i am trying to upload a image file ...using paperclip in rails 3
> i did as follows
>  1. In gemfile => included gem paperclip
>
> 2.In config/environments /development.rb =>
> Paperclip.options[:command_path] = "/usr/bin/" (convert path)
>
> 3.created a controller *picusers *and defined => def create
> @picuser = Picuser.create(params[:picuser])
>   end
>
> 4.created  a model *picuser *with =>has_attached_file :avatar, :styles =>
> {:medium => "300*300>", :thumb => "100*100>" }
>created a migration file  with following columns => class
> AddAvatarColumnsToPicusers < ActiveRecord::Migration
>
> def self.up
>
> add_column :picusers, :avatar_file_name, :string
>
>  add_column :picusers, :avatar_content_type, :string
>
> add_column :picusers, :avatar_file_size, :integer
>
> add_column :picusers, :avatar_updated_at, :datetime
>
> end
>   def
> self.down
>
> remove_column :picusers, :avatar_file_name
>
> remove_column :picusers, :avatar_content_type
>
> remove_column :picusers, :avatar_file_size
>
> remove_column :picusers, :avatar_updated_at
> end
>  end
>
>
> 5. created a view with picuser => show.html.erb
> <%= image_tag
> @picuser.avatar.url %>
> <%= image_tag
> @picuser.avatar.url(:medium) %>
> <%= image_tag
> @picuser.avatar.url(:thumb) %>
>
> => edit.html.erb
>   <% form_for :picuser, @picuser,
> :url => picuser_path, :html => { :multipart => true } do |form| %>
><%= form.file_field :avatar %>
>  <% end %>
>=> new.html.erb
>  <% form_for :picuser, @picuser, :url
> => picuser_path(current_picuser.id), :html => { :multipart => true } do
> |form| %>
><%= form.file_field :avatar %>
>  <% end %>
>
>
> *GETTING ERROR AS NO ROUTE MATCHES :SHOW CONTROLLER:PICUSERS EVEN AFTER
> SETTING ROUTES.RB
> PLEASE COULDANYONE THERE HELP
> *
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>



-- 

Please consider the environment before printing this email.

Regards,
Surya

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



[Rails] Re: How can I disable Rails 3.1's ActiveRecord Query Caching?

2011-08-07 Thread Phoenix Rising
As usual, Fred - you're the man.  Thanks a ton.  One other question,
however: how exactly can I remove that from the middleware stack?
Looking at 
http://api.rubyonrails.org/classes/ActionDispatch/MiddlewareStack.html,
I'm not seeing any method that I can use to "subtract" this from the
stack.  My understanding is that I'd do it something like this:

# app/config/environments/development.rb
MyApp::Application.configure do
  # ... other stuff ...
  config.middleware.??? ActiveRecord::QueryCache
end

What method should I use in place of ??? ? (damn that's a lot of
question marks). The only thing I can guess at this point would be
using swap and calling nil on that, to swap that middleware with
"nil", but that seems really...off:

config.middleware.swap ActiveRecord::QueryCache, nil

In theory that would work, but is there a cleaner way to do it?

Any input here?  Thanks again!

On Aug 7, 2:52 am, Frederick Cheung 
wrote:
> On Aug 7, 5:55 am, Phoenix Rising  wrote:
>
>
>
>
>
>
>
>
>
> > Hey guys,
>
> > As most of you know, Rails 3.1 introduces query caching for
> > ActiveRecord.  Great change all-in-all, but for those of us with IT
> > department mandates for using MySQL (yeah, yeah, I know...), it's kind
> > of a mixed bag.
>
> > I need to disable query caching in a project I'm building based on
> > 3.1.  I've tried a couple different approaches, both without any
> > success.  I was hoping some one could enlighten me on how to do that,
> > exactly.
>
> > The first approach I tried was to create an initializer (config/
> > initializer/active_record.rb) and include this code:
> > ActiveRecord::Base.connection.disable_query_cache!
>
> > (Documented 
> > athttp://edgeapi.rubyonrails.org/classes/ActiveRecord/ConnectionAdapter...
> > without comments or examples, unsurprisingly).
>
> > This doesn't appear to work as I'm still seeing prepared statement
> > caching going on in my log file:
> > Started GET "/dashboard" for 127.0.0.1 at 2011-08-06 22:43:07 -0600
> >   Processing by DashboardController#index as HTML
> >   User Load (13.4ms)  SELECT "users".* FROM "users" WHERE "users"."id"
> > = $1 LIMIT 1  [["id", 1]]
> > Rendered dashboard/index.html.erb within layouts/application (0.3ms)
> >   CACHE (0.0ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1
> > LIMIT 1
>
> > So my next attempt was to place it in config/environments/
> > development.rb (I'm of course trying to get this to work in
> > development mode before doing it in production, obviously):
>
> > MyApp::Application.configure do
> >   # ... other stuff ...
> >   config.active_record.disable_query_cache!
> > end
>
> > Same deal.  I tried also changing that to
> > config.active_record.cache_queries = false - no such luck (and that
> > was just a long shot guess).
>
> > Can anyone explain to me exactly how I'm supposed to turn this off?
> > Thanks.
>
> The ActiveRecord::QueryCache middleware turns on query caching during
> for each request. Remove it from the middleware stack and you should
> be ok (http://guides.rubyonrails.org/configuring.html#configuring-middleware
> )
>
> Fred

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



[Rails] How do I select the include order of CSS/SASS files?

2011-08-07 Thread Ezequiel Schwartzman
Hello, I'm tweaking around with SASS and I'm kind of stuck here.

I did a /app/assets/stylesheets/reset.css.scss file, surprisingly it's
included automagically in all controllers.

The problem is that it's included after the layout CSS and before the
controllers CSS, and I need it to be included after everything =/

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



[Rails] Re: New field does now show in browser

2011-08-07 Thread 7stud --
Did you ever add any phone numbers to your database?

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



[Rails] using bundler while developing a gem.

2011-08-07 Thread Tim Uckun
I want to be able to specify something like this.

group :development do
  gem 'mygem', :path => File.expand_path(File.dirname(__FILE__) + '/../mygem')
end

group :production do
gem 'bingatron-core', :git => "g...@github.com:myaccount/mygem.git"
end


Bundler doesn't like this at all and complains I am specifying the
same gemname twice

I tried doing something like if ::Socket.gethostname == 'myhost' gem ...

but that doesn't work either because the Gemfile.lock ends up with the
wrong gem when capistrano deploys.

What is a good strategy for dealing with this?

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



[Rails] Re: Question About Forms

2011-08-07 Thread Bruno Meira
Hi Perry,
Thanks for help me, I will try to follow your tips ;D
May I ask you another question?
If yes, my question is:
Is a good practice in this page has only one BIG form that treat
all the actions and this action has a lot of (if
params[:button_name]),  or has many forms responsible to treat each
action?

Thanks ;D

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



[Rails] Re: accessing a variable from an each loop

2011-08-07 Thread 7stud --
You also have to realize that javascript executes in a browser, and 
ruby/rails executes on the server.  What that means is that when this 
appears in a .html.erb file:

 $("button").click(function () {
  $("<%= "#subcomNormal_#{comment[:id]}" %>").toggle();});

rails will do the string interpolations #{..} and the <%=  %> 
substitutions to give you something like:

$("button").click(function () {
  $("#subcomNormal_3").toggle();});

But that code executes in the browser.  And $("button") finds ALL the 
buttons on the page.  Writing this:

<% @user.comments.each do |comment| %>

  Hide

  $("button").click(function () {

<% end %>


...does not limit the 'button' selector to that  tag.

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



[Rails] Re: accessing a variable from an each loop

2011-08-07 Thread 7stud --
Neil Bye wrote in post #1015384:
> Hi
>
> If you look at the attached file you will see the jQuery is inside the
> each loop, result, it toggles all comments when any hide is clicked.
>
> I want to move the jQuery outside the loop but if I do it throws an
> error saying 'undefined local variable or method `comment' '
>
> Is there any way I can pass the comment variable from the loop to the
> jQuery.
>

No.  comment is a local variable and ceases to exist outside the block.


> If I'm going about this the wrong way please let me know.
>

Reverse engineering from your results, this line:

$("button").click(function () {
  $("<%= "#subcomNormal_#{comment[:id]}" %>").toggle();});

retrieves all the buttons currently on the page, and adds the current
version of the click-function to all the buttons.  What you want to do
is add the current version of the click-function to only one button. 
How do
you identify that button?  How about adding the comment id to the
 tag:

 >

and then saying:

$(button#<%= comment.id %>).click()

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



[Rails] Re: get an arbitrary collection from gems?

2011-08-07 Thread jdkealy
W/ the help of someone in IRC (), i did it like this...

I put this in my main Gem
module DevapeMemberNavigation
  mattr_accessor :items
  self.items = []
  module Hooks
def register_navigation_item(item)
  DevapeMemberNavigation.items << item
end
  end
end

module DevapeCms
  extend DevapeMemberNavigation::Hooks
end

DevapeCms.register_navigation_item('/member/posts')


In another Gem, I wrote
require "devape_cms"

module DevapeSurvey
  extend DevapeMemberNavigation::Hooks
end

DevapeSurvey.register_navigation_item('/member/surveys')

Then, in my main app, this will return the desired array <%=
DevapeMemberNavigation.items %>



On Aug 7, 4:51 pm, jdkealy  wrote:
> Hi,
>
> I'm looking to do something though I'm not quite sure how to phrase
> it. What I'm looking to do is, essentially, make custom hooks using
> plugins/engines/gems.
>
> My use case is a member dashboard:
>
> I have a view partial for my site and a number of gems that I wrote
> installed. Each gem correlates to something a member can manage, like
> a photo gallery, their profile, their friends, etc.
>
> Now, I know I could open up my view partial and code links to each one
> of these things, eg:
>
> Manage Photos
>
> But, I was hoping for something slightly more modular, and was hoping
> I could figure out some way to hook these links in dynamically when I
> install my gem and or run my generators.
>
> In other CMS' I have used, this was possible. Wordpress for example
> had a hook, and Magento had an XML based admin navigation when the
> links to manage your account were dynamically populated.
>
> What would be a way to go about this in Rails? I've thought of making
> a db table and writing to it with seeds when I run each gem's
> generators. But I was hoping something simpler. Is there some way I
> could essentially get a collection from my gems' lib files?

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



Re: [Rails] New field does now show in browser

2011-08-07 Thread Walter Lee Davis


On Aug 7, 2011, at 3:18 PM, Pepe Sanchez wrote:


Hi all

I just added a new field phone to form _form.html.erb created with:

 rails generate migration AddPhoneTotickets  phone:string

 added with rake migraiton

and the new field does not show in the browser

new


   <%= f.label :phone %>
   <%= f.text_field :phone %>
 


old


   <%= f.label :phone %>
   <%= f.text_field :phone %>
 



Did you add the form element in your view by hand? The migration alone  
will not create it. If you added the field to the view, ran the  
migration, and re-started the server, you should see the new field.


Walter

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



[Rails] Re: Rails Server Failing - No such file or directory - tmp/pids/server.pid

2011-08-07 Thread Ben M.
I had this problem. I deleted my app's directory and brought down the 
code from scratch from GitHub.  Rails server worked after that.

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



[Rails] get an arbitrary collection from gems?

2011-08-07 Thread jdkealy
Hi,

I'm looking to do something though I'm not quite sure how to phrase
it. What I'm looking to do is, essentially, make custom hooks using
plugins/engines/gems.

My use case is a member dashboard:

I have a view partial for my site and a number of gems that I wrote
installed. Each gem correlates to something a member can manage, like
a photo gallery, their profile, their friends, etc.

Now, I know I could open up my view partial and code links to each one
of these things, eg:

Manage Photos

But, I was hoping for something slightly more modular, and was hoping
I could figure out some way to hook these links in dynamically when I
install my gem and or run my generators.

In other CMS' I have used, this was possible. Wordpress for example
had a hook, and Magento had an XML based admin navigation when the
links to manage your account were dynamically populated.

What would be a way to go about this in Rails? I've thought of making
a db table and writing to it with seeds when I run each gem's
generators. But I was hoping something simpler. Is there some way I
could essentially get a collection from my gems' lib files?

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



Re: [Rails] Can't destroy record

2011-08-07 Thread Tom Meinlschmidt
and source of your controller/view?
do you have :method => :delete in your link to delete?

tom

On Aug 6, 2011, at 11:21 , depassion wrote:

> so when attempting to destroy a record i get this in the server log
> output:
> 
> AREL (0.4ms)  DELETE FROM "items" WHERE "items"."id" = 39
> Started GET "/items/20" for 127.0.0.1 at 2011-08-06 10:59:27 +0200
> AbstractController::ActionNotFound (The action 'show' could not be
> found for ItemsController):
> 
> but a normal destroy should look like this:
> 
> Started DELETE "/transactions/3" for 127.0.0.1 at 2011-08-06 11:06:03
> +0200
>  Processing by TransactionsController#destroy as HTML
>  Parameters: {"authenticity_token"=>"FNi4GDXZGn3yJNXZanNZ3J/
> vggiMeR7zb/hpmf66s3U=", "id"=>"3"}
>  Transaction Load (0.1ms)  SELECT "transactions".* FROM
> "transactions" WHERE "transactions"."id" = ? LIMIT 1  [["id", "3"]]
>  SQL (0.4ms)  DELETE FROM "transactions" WHERE "transactions"."id"
> = ?  [["id", 3]]
> Redirected to http://localhost:3000/transactions
> Completed 302 Found in 14ms
> 
> -- 
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
===
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===

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



[Rails] New field does now show in browser

2011-08-07 Thread Pepe Sanchez
Hi all

I just added a new field phone to form _form.html.erb created with:

  rails generate migration AddPhoneTotickets  phone:string

  added with rake migraiton

and the new field does not show in the browser

new

 
<%= f.label :phone %>
<%= f.text_field :phone %>
  


old

 
<%= f.label :phone %>
<%= f.text_field :phone %>
  

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



[Rails] Re: Tutorials

2011-08-07 Thread John Ivanoff

Ruby 1.9.2 Rails 3, A Clean Install on Windows XP
http://bit.ly/lNxcB1


Cheers,
John



On Aug 6, 2:20 pm, Colin Law  wrote:
> On 6 August 2011 15:59, Rahul Rai  wrote:
>
> > I have struggled a lot to run my first rails app on  windows
>
> If you have any choice at all then don't use windows for rails apps.
> Life will be much simpler if you can move to a Linux system such as
> Ubuntu.  The learning curve time will be recovered very quickly.  You
> can make a dual boot system so you can boot into Windows or Ubuntu and
> may soon find your life becoming a Windows free environment.  It is
> great to take control of your PC again.  There are also various ways
> of using virtual machines to run windows and ubuntu together.
>
> 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Best Mongo Framework to work with Rails

2011-08-07 Thread Vasco Andrade e Silva
Thank you all for your answers!

Cheers,
Vasco Andrade e Silva

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



[Rails] accessing a variable from an each loop

2011-08-07 Thread Neil Bye
Hi

If you look at the attached file you will see the jQuery is inside the
each loop, result, it toggles all comments when any hide is clicked.

I want to move the jQuery outside the loop but if I do it throws an
error saying 'undefined local variable or method `comment' '

Is there any way I can pass the comment variable from the loop to the
jQuery.

If I'm going about this the wrong way please let me know.

Neil

PS

This is an extension to this thread

http://www.ruby-forum.com/topic/1680180#new

but I am reposting because the title no longer bears any relation to the
problem I have now.

Attachments:
http://www.ruby-forum.com/attachment/6512/_subcomment.html.erb


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



[Rails] Re: Browser caching of javascript files

2011-08-07 Thread Frederick Cheung


On Aug 7, 6:49 pm, Perry Smith  wrote:
> I'm using the latest Firefox and firebug with Rails 2.3.11 (and Ruby
> 1.9.1).
>
> I see my javascript assets have the last modified date, such as:
>
>     javascripts/prototype.js?123456789
>
> which has been the case for a while.  What I just noticed is that
> Firefox (according to Firebug) is fetching this for each request.  This
> is for a Rails server running in "production" mode.  The browser's
> caching settings are normal (true for things like
> browser.cache.disk.enable and browser.cache.memory.eable).
>
> With my super small internet connection, pulling over prototype,
> scriptaculous, and all its friends is a significant hit -- plus, it just
> doesn't make any sense for it to do it every time.
>
> The underlying environment is Apache and Thin (both relatively recent).
> It seems like either the browser should not attempt to fetch it at all
> (which it tends to do if the ?123456789 isn't there) or the server
> should be returning 304 (not modified).
>
> Is this normal?  What options do I have to change this?

You're actually getting a 200 request back with the full file?

If you want the browser not to bother even fetching the file then you
need to set headers saying that content can be cached.

Something like


ExpiresActive on
ExpiresDefault "access plus 21 days"


should tell browsers that they can cache stuff from javascripts for up
to 21 days.
For stuff like prototype, scriptaculous etc you might want to consider
using the copies hosted by ( http://code.google.com/apis/libraries/ ).
That way those files come from google's network rather than yours and
they take care of setting all the right caching headers (as well as
having a cdn that is spread worldwide)

Fred


Fred
>
> Thank you,
> pedz
>
> --
> 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Question About Forms

2011-08-07 Thread Perry Smith
| Example: In this page I
| 1) send message to user,
| 2) make one vote in one post,
| 3) remove one post.

I'm not 100% sure what you mean by #1 but I'll assume that it requires a
text area and a submit button.  I'd probably use a regular form for this
although scriptaculous offers many "Web 2.0" ways to do this as well
(http://script.aculo.us/)

#2 can be done with an AJAX request.  I'd have a button and use the
"onClick" event of the button to send the AJAX request to a method that
is looking for a "post".  e.g. in your routes file, define the action's
method as :post.  There should be samples in various Rails documents and
also perhaps on the prototypejs.org site (since you are likely using
prototype.js as your javascript library).

#3 appears to me as the normal delete.  Go to the typical
"index.html.erb" page for a sample of how to do a delete in Rails.  It
appears to the user as just a link and sends a "delete" http message
(although its not really a delete http message as I recall).  #3 in
particular indicates that you need to learn about "Restful" routes in
Rails.  Its really wonderful.  There are tons of info about Restful
routes on the web.

The Rails book(s) from Pragmatic Programmers is very good and would help
here.

Good luck!
pedz

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

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



[Rails] Browser caching of javascript files

2011-08-07 Thread Perry Smith
I'm using the latest Firefox and firebug with Rails 2.3.11 (and Ruby
1.9.1).

I see my javascript assets have the last modified date, such as:

javascripts/prototype.js?123456789

which has been the case for a while.  What I just noticed is that
Firefox (according to Firebug) is fetching this for each request.  This
is for a Rails server running in "production" mode.  The browser's
caching settings are normal (true for things like
browser.cache.disk.enable and browser.cache.memory.eable).

With my super small internet connection, pulling over prototype,
scriptaculous, and all its friends is a significant hit -- plus, it just
doesn't make any sense for it to do it every time.

The underlying environment is Apache and Thin (both relatively recent).
It seems like either the browser should not attempt to fetch it at all
(which it tends to do if the ?123456789 isn't there) or the server
should be returning 304 (not modified).

Is this normal?  What options do I have to change this?

Thank you,
pedz

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

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



[Rails] Re: Question about link_to

2011-08-07 Thread 7stud --
Pepe Sanchez wrote in post #1015368:
>

First of all, I think this:

<%= link_to 'New Ticket', new_ticket_path %>

should say:  new_tickets_path.  Note the plural form of tickets.  At 
least that is the way it is in Rails 3.09.   Head First Rails is an old 
enough book that it's probably not worth studying.  2008??!  That's a 
lifetime ago in computer programming, and rails changes faster than most 
things in the programming world.


> I understand now!
>
> To generate a link in my RoR application I just need to prefix the word
> "_path" with a controller name and it finds it.
>


That's not necessarily true.  You were on the right track to begin with. 
The second argument to the link_to method can be a path.  Rails will 
create some paths for you and assigns names to them, like 
new_tickets_path, which you can use as the second argument to link_to. 
Rails also automatically creates some methods you can use:

new_ticket_path(@ticket)

which creates the path to a page that shows a particular ticket.  But if 
one of those 'constants' or methods actually produces the path:

  '/some_page'

You could just specify that path directly yourself:

<%= link_to 'New Ticket', '/somepage' %>

As long as your routes file maps the path you specify as the second 
argument to link_to to one of your actions, it will work.

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



[Rails] Re: "bundle install" fails because of git gem

2011-08-07 Thread jjb123
I just checked and "git clone https://github.com/renatosnrg/linkedin.git";
worked in the directory I'm trying to run "bundle install" in.

On Aug 7, 6:02 am, Conrad Taylor  wrote:
> On Sun, Aug 7, 2011 at 2:11 AM, Frederick Cheung 
> > wrote:
>
> > On Aug 7, 2:28 am, jjb123  wrote:
> > > Yep, it's installed (I've used it on the server before). I'm not sure
> > > but I think this has something to do with RVM changing all of the
> > > application paths but I don't really know how to diagnose this.
>
> > Can you clone the repository in question from the command line?
>
> > Fred
>
> Jimmy, Fred makes a very good point.  Please verify that the following
> works where you're trying to execute `bundle install`:
>
> git clonehttps://github.com/renatosnrg/linkedin.git
>
> The above worked for me without any issues and I'm using rvm as well.
>
> -Conrad
>
>
>
>
>
>
>
> > > On Aug 6, 4:33 am, Frederick Cheung 
> > > wrote:
>
> > > > On Aug 6, 12:59 am, jjb123  wrote:> Hey
> > everyone,
> > > > > I'm having an incredibly difficult time getting bundle to work
> > > > > properly on my production server.
>
> > > > Dumb question: isgitinstalled (and is it a sufficiently recent
> > > > version that it can work with https urls) ?
>
> > > > Fred
>
> > > > > My production server setup:
> > > > > Ubuntu 10.04
> > > > > Ruby 1.9.2p290
> > > > > Rails 3.0.4
> > > > > Passenger
> > > > > rvm 1.6.32
>
> > > > > My Gemfile (relevant parts):
> > > > >gem'linkedin', :git=> "https://github.com/renatosnrg/linkedin.git";
>
> > > > > Whenever I try to do "bundle install" I get this error:
> > > > > "https://github.com/renatosnrg/linkedin.git(atmaster) is not checked
> > > > > out. Please run `bundle install`"
>
> > > > > "bundle install" works perfectly on my development machine.
>
> > > > > Does anyone have any ideas? I have no clue how to fix this.
>
> > --
> > 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Question about link_to

2011-08-07 Thread Colin Law
On 7 August 2011 15:31, Pepe Sanchez  wrote:
> I understand now!
>
> To generate a link in my RoR application I just need to prefix the word
> "_path" with a controller name and it finds it.

That is only part of it.  Did you read the Rails Guide on routing, as
Walter suggested.  This is absolutely required reading (and
understanding).

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



[Rails] Re: Question about link_to

2011-08-07 Thread Pepe Sanchez
I understand now!

To generate a link in my RoR application I just need to prefix the word 
"_path" with a controller name and it finds it.

Thanks

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



Re: [Rails] About the present method in rails, how to use?

2011-08-07 Thread coolesting
Many thanks to Alejandro,  that is very helpful.

2011/8/7 Alejandro Cadavid 

> Hey
>
> First, be careful, the name of the method is actually "present?", with
> the '?'. There is another method called "blank?", what this last
> method does is asking if an object (or variable) is, let's say, in a
> 'black state', that is whether it is nil, empty or an empty string and
> returns true. So you would do things like:
>
> book = ""
>
> if book.blank?
>  book = writer.write_book
> else
>  speaker.read_book(book)
> end
>
> We are asking if the book has something written on it, and if it
> doesn't, we write something on it, otherwise, just read it. As you can
> see, book is "" which is an empty string, so something will be written
> there.
>
> If you go and check the source code
> (http://apidock.com/rails/Object/present%3F) of "present?", you will
> find this :
>
> def present?
>  !blank?
> end
>
> From this we can say that an object will return true if it is NOT
> blank. To summarize, "present?" checks if an object is nil, or empty,
> or "" and returns false if the object is in fact in one of the
> previous states, otherwise it returns true.
>
> So we could rewrite the previous example as
>
> if book.present?
>  speaker.read_book(book)
> else
>  book = writer.write_book
> end
>
> Hope this helps!
>
> On Sun, Aug 7, 2011 at 7:45 AM, coolesting  wrote:
> > Hi, guys
> >
> > I read this book 'Agile  web development with rails' and know this method
> > present, so i have some question.
> > How to use this present method?
> > What is the usage of this method ?
> > Can you give me a example for explaining it?
> >
> > Thanks a lot.
> >
> > --
> > 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+unsubscr...@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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] About the present method in rails, how to use?

2011-08-07 Thread Alejandro Cadavid
Hey

First, be careful, the name of the method is actually "present?", with
the '?'. There is another method called "blank?", what this last
method does is asking if an object (or variable) is, let's say, in a
'black state', that is whether it is nil, empty or an empty string and
returns true. So you would do things like:

book = ""

if book.blank?
  book = writer.write_book
else
  speaker.read_book(book)
end

We are asking if the book has something written on it, and if it
doesn't, we write something on it, otherwise, just read it. As you can
see, book is "" which is an empty string, so something will be written
there.

If you go and check the source code
(http://apidock.com/rails/Object/present%3F) of "present?", you will
find this :

def present?
  !blank?
end

>From this we can say that an object will return true if it is NOT
blank. To summarize, "present?" checks if an object is nil, or empty,
or "" and returns false if the object is in fact in one of the
previous states, otherwise it returns true.

So we could rewrite the previous example as

if book.present?
  speaker.read_book(book)
else
  book = writer.write_book
end

Hope this helps!

On Sun, Aug 7, 2011 at 7:45 AM, coolesting  wrote:
> Hi, guys
>
> I read this book 'Agile  web development with rails' and know this method
> present, so i have some question.
> How to use this present method?
> What is the usage of this method ?
> Can you give me a example for explaining it?
>
> Thanks a lot.
>
> --
> 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] PROBLEM WITH PAPERCLIP

2011-08-07 Thread Annapoorna R
hello,

i am trying to upload a image file ...using paperclip in rails 3
i did as follows
 1. In gemfile => included gem paperclip

2.In config/environments /development.rb => Paperclip.options[:command_path]
= "/usr/bin/" (convert path)

3.created a controller *picusers *and defined => def create
@picuser = Picuser.create(params[:picuser])
  end

4.created  a model *picuser *with =>has_attached_file :avatar, :styles =>
{:medium => "300*300>", :thumb => "100*100>" }
   created a migration file  with following columns => class
AddAvatarColumnsToPicusers < ActiveRecord::Migration

def self.up

add_column :picusers, :avatar_file_name, :string

 add_column :picusers, :avatar_content_type, :string

add_column :picusers, :avatar_file_size, :integer

add_column :picusers, :avatar_updated_at, :datetime

end
  def
self.down

remove_column :picusers, :avatar_file_name

remove_column :picusers, :avatar_content_type

remove_column :picusers, :avatar_file_size

remove_column :picusers, :avatar_updated_at
end
 end


5. created a view with picuser => show.html.erb
<%= image_tag
@picuser.avatar.url %>
<%= image_tag
@picuser.avatar.url(:medium) %>
<%= image_tag
@picuser.avatar.url(:thumb) %>

=> edit.html.erb
  <% form_for :picuser, @picuser,
:url => picuser_path, :html => { :multipart => true } do |form| %>
   <%= form.file_field :avatar %>
 <% end %>
   => new.html.erb
 <% form_for :picuser, @picuser, :url =>
picuser_path(current_picuser.id), :html => { :multipart => true } do |form|
%>
   <%= form.file_field :avatar %>
 <% end %>


*GETTING ERROR AS NO ROUTE MATCHES :SHOW CONTROLLER:PICUSERS EVEN AFTER
SETTING ROUTES.RB
PLEASE COULDANYONE THERE HELP
*

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



[Rails] About the present method in rails, how to use?

2011-08-07 Thread coolesting
Hi, guys

I read this book 'Agile  web development with rails' and know this method
present, so i have some question.
How to use this present method?
What is the usage of this method ?
Can you give me a example for explaining it?

Thanks a lot.

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



Re: [Rails] Re: "bundle install" fails because of git gem

2011-08-07 Thread Conrad Taylor
On Sun, Aug 7, 2011 at 2:11 AM, Frederick Cheung  wrote:

>
>
> On Aug 7, 2:28 am, jjb123  wrote:
> > Yep, it's installed (I've used it on the server before). I'm not sure
> > but I think this has something to do with RVM changing all of the
> > application paths but I don't really know how to diagnose this.
> >
> Can you clone the repository in question from the command line?
>
> Fred
>

Jimmy, Fred makes a very good point.  Please verify that the following
works where you're trying to execute `bundle install`:

git clone https://github.com/renatosnrg/linkedin.git

The above worked for me without any issues and I'm using rvm as well.

-Conrad


> > On Aug 6, 4:33 am, Frederick Cheung 
> > wrote:
> >
> >
> >
> >
> >
> >
> >
> > > On Aug 6, 12:59 am, jjb123  wrote:> Hey
> everyone,
> > > > I'm having an incredibly difficult time getting bundle to work
> > > > properly on my production server.
> >
> > > Dumb question: isgitinstalled (and is it a sufficiently recent
> > > version that it can work with https urls) ?
> >
> > > Fred
> >
> > > > My production server setup:
> > > > Ubuntu 10.04
> > > > Ruby 1.9.2p290
> > > > Rails 3.0.4
> > > > Passenger
> > > > rvm 1.6.32
> >
> > > > My Gemfile (relevant parts):
> > > >gem'linkedin', :git=> "https://github.com/renatosnrg/linkedin.git";
> >
> > > > Whenever I try to do "bundle install" I get this error:
> > > > "https://github.com/renatosnrg/linkedin.git(atmaster) is not checked
> > > > out. Please run `bundle install`"
> >
> > > > "bundle install" works perfectly on my development machine.
> >
> > > > Does anyone have any ideas? I have no clue how to fix this.
>
> --
> 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: upload zip file with paperclip

2011-08-07 Thread Frederick Cheung


On Aug 7, 10:46 am, Aashish Kiran  wrote:
> Frederick Cheung wrote in post #1015275:
>
> > On Aug 4, 7:32pm, Aashish Kiran  wrote:
>
> >> ?> p.preview.url
> >> => "/system/previews/3/original/FTpreview.zip?1312375624"
>
> >> ?> file=p.preview.url
> >> => "/system/previews/3/original/FTpreview.zip?1312375624"
>
> > url returns the url at which the file is available when accessed via
> > the web server - as you have demonstrated below, the file isn't at /
> > system/previews/...
> > The path method returns the local path to the file.
>
> > Fred
>
> Even when I changed the path to like
>
> file = 'C:\Documents and
> settings\Administration\project\public\system\previews\3\original\FTpreview 
> .zip
>
> I get error as : \FTpreview.zip not found.
>
You'd need to escape the backslashes. Not sure how ruby handles
windows style paths.

Fred
> Can you help me.
>
> let me post new code.
>
> --
> 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: upload zip file with paperclip

2011-08-07 Thread Aashish Kiran
Here is the code and error list below. After creating a zip file in 
original folder. When I tried to run the from rails console, it works 
great, but getting error when user tries to upload. So, I thought of 
doing a delay job, and tried to run same code in show action but got 
same error.

Any help would be great.



--code--
# unzip preview file after upload
require 'rubygems'
require 'zip'
file = RAILS_ROOT + '/system/previews/' + self.id.to_s + 
'/original/' + self.preview_file_name
destination = RAILS_ROOT + '/system/previews/' + self.id.to_s + 
'/original/'
logger.info file
Zip::ZipFile.open(file) { |zip_file|
  zip_file.each { |f|
f_path=File.join(destination, f.name)
FileUtils.mkdir_p(File.dirname(f_path))
zip_file.extract(f, f_path) unless File.exist?(f_path)
  }
}
--error
Zip::ZipError (File C:/Documents and 
Settings/Administrator/kmartapp/trunk/kmart/system/previews/10/origin
al/FTpreview.zip not found):
  zip (2.0.2) lib/zip/zip.rb:1370:in `initialize'
  zip (2.0.2) lib/zip/zip.rb:1384:in `new'
  zip (2.0.2) lib/zip/zip.rb:1384:in `open'
  app/models/kproduct.rb:87:in `unzip_file'
  app/controllers/kproducts_controller.rb:16:in `show'
  C:/Ruby187/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  C:/Ruby187/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  C:/Ruby187/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  C:/Ruby187/lib/ruby/1.8/webrick/server.rb:162:in `start'
  C:/Ruby187/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  C:/Ruby187/lib/ruby/1.8/webrick/server.rb:95:in `start'
  C:/Ruby187/lib/ruby/1.8/webrick/server.rb:92:in `each'
  C:/Ruby187/lib/ruby/1.8/webrick/server.rb:92:in `start'
  C:/Ruby187/lib/ruby/1.8/webrick/server.rb:23:in `start'
  C:/Ruby187/lib/ruby/1.8/webrick/server.rb:82:in `start'

Rendered rescues/_trace (62.5ms)
Rendered rescues/_request_and_response (15.6ms)
Rendering rescues/layout (internal_server_error)

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

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



[Rails] Re: Can't destroy record

2011-08-07 Thread depassion
[SOLVED] sorry, i forgot that you do actually need some kind of js
framework. After removing prototype i didn't replace it with jQuery,
but now that i have the destroy action works fine.

thanks.

On Aug 6, 11:42 am, Conrad Taylor  wrote:
> On Sat, Aug 6, 2011 at 2:21 AM, depassion  wrote:
> > so when attempting to destroy a record i get this in the server log
> > output:
>
> > AREL (0.4ms)  DELETE FROM "items" WHERE "items"."id" = 39
> > Started GET "/items/20" for 127.0.0.1 at 2011-08-06 10:59:27 +0200
> > AbstractController::ActionNotFound (The action 'show' could not be
> > found for ItemsController):
>
> > but a normal destroy should look like this:
>
> > Started DELETE "/transactions/3" for 127.0.0.1 at 2011-08-06 11:06:03
> > +0200
> >  Processing by TransactionsController#destroy as HTML
> >  Parameters: {"authenticity_token"=>"FNi4GDXZGn3yJNXZanNZ3J/
> > vggiMeR7zb/hpmf66s3U=", "id"=>"3"}
> >  Transaction Load (0.1ms)  SELECT "transactions".* FROM
> > "transactions" WHERE "transactions"."id" = ? LIMIT 1  [["id", "3"]]
> >  SQL (0.4ms)  DELETE FROM "transactions" WHERE "transactions"."id"
> > = ?  [["id", 3]]
> > Redirected tohttp://localhost:3000/transactions
> > Completed 302 Found in 14ms
>
> Kevin, please post the actual Ruby code associated with the above queries.
>
> Thanks,
>
> -Conrad> --
> > 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: upload zip file with paperclip

2011-08-07 Thread Aashish Kiran
Frederick Cheung wrote in post #1015275:
> On Aug 4, 7:32pm, Aashish Kiran  wrote:
>
>> ?> p.preview.url
>> => "/system/previews/3/original/FTpreview.zip?1312375624"
>>
>> ?> file=p.preview.url
>> => "/system/previews/3/original/FTpreview.zip?1312375624"
>
> url returns the url at which the file is available when accessed via
> the web server - as you have demonstrated below, the file isn't at /
> system/previews/...
> The path method returns the local path to the file.
>
> Fred

Even when I changed the path to like

file = 'C:\Documents and 
settings\Administration\project\public\system\previews\3\original\FTpreview.zip

I get error as : \FTpreview.zip not found.

Can you help me.

let me post new code.

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



[Rails] Re: "bundle install" fails because of git gem

2011-08-07 Thread Frederick Cheung


On Aug 7, 2:28 am, jjb123  wrote:
> Yep, it's installed (I've used it on the server before). I'm not sure
> but I think this has something to do with RVM changing all of the
> application paths but I don't really know how to diagnose this.
>
Can you clone the repository in question from the command line?

Fred
> On Aug 6, 4:33 am, Frederick Cheung 
> wrote:
>
>
>
>
>
>
>
> > On Aug 6, 12:59 am, jjb123  wrote:> Hey everyone,
> > > I'm having an incredibly difficult time getting bundle to work
> > > properly on my production server.
>
> > Dumb question: isgitinstalled (and is it a sufficiently recent
> > version that it can work with https urls) ?
>
> > Fred
>
> > > My production server setup:
> > > Ubuntu 10.04
> > > Ruby 1.9.2p290
> > > Rails 3.0.4
> > > Passenger
> > > rvm 1.6.32
>
> > > My Gemfile (relevant parts):
> > >gem'linkedin', :git=> "https://github.com/renatosnrg/linkedin.git";
>
> > > Whenever I try to do "bundle install" I get this error:
> > > "https://github.com/renatosnrg/linkedin.git(atmaster) is not checked
> > > out. Please run `bundle install`"
>
> > > "bundle install" works perfectly on my development machine.
>
> > > Does anyone have any ideas? I have no clue how to fix this.

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



[Rails] Re: Newbie, are these associations right?

2011-08-07 Thread Frederick Cheung


On Aug 7, 12:43 am, MC  wrote:
> Frederick,
>
> I would want to be able to see what students are being taught be what
> instructor. And yes I would want to be able to know what the course
> the student is taking. So from  my current setup are you saying I
> wouldn't get that? Or would I get that if I used a :through
> association?


It depends on the reality you are modelling. At the moment, a student
belongs_to instructor, which has_many courses - how can you extract
from that which course a student on. Is it really the case that a
student always has the same instructor, no matter what combination of
courses?

> I'm sort of having a tough time wrapping my head around the
> associations. I read the rails guide on associations but it's not
> sticking yet. Is the whole point of associations being able to make
> calls to the records because of active record's built in
> capabilities?
>
Using associations does get you all that, but before thinking about
that I think you need to step back and think about the data you are
trying to model and what questions you will need to be able to answer.
For example with you current setup, you can't represent a student
having one instructor for their Spanish course and a different one for
their Russian literature (but only you can say whether or not this
restriction is ok).

To me if feels like you want a join model between courses and students
that defines which courses a student is taking and with which
instructor, but I don't know precisely what the reality that you are
trying to model

> With regard to what you mentioned about CourseDate and CourseTime and
> just making them additional columns. Could I still call that
> information and post it to a calendar some how?
>
> My confusion over relationships starts making me think that I should
> make everything an object class. Has anyone else felt this way? Is
> there a guideline for when you make something it's own class as
> opposed to just making it a column in a table?
>

You haven't said what is in those tables. If they just a simple date
and a simple time column, then i don't think there's any reason. If
you're managing a more complicated schedule then it might deserve its
own table (e.g. if course date meant something like 'tuesdays and
thursdays'). Bottom line is I would ask myself for the given situation

- what data might I be duplicating
- how does this change my ability to ask (efficiently) the questions
that I want to answer (e.g. 'what courses are on today' or 'when does
this course start)

If there's no benefit to having a separate table then that suggests to
me that the things in question are more naturally just attributes.

Fred.


> Mark
>
> On Aug 6, 2:42 am, Frederick Cheung 
> wrote:
>
>
>
>
>
>
>
> > On Aug 6, 9:07 am, MC  wrote:
>
> > > First crack at an app. I have a friend with a private school that I'm
> > > trying to create a scheduling system for.
>
> > > So I have Coordinators creating school courses. Once the course is
> > > created the coordinator can assign multiple instructors, and then
> > > assign students to the course and instructor. So is this right?
>
> > Are you even going to need to have students that belong to multiple
> > instructors? Are you going to want to know what course the student is
> > taking ? From the associations you've given you don't seem to be
> > storing that bit of information, the best you could work out is that
> > given their instructor there are only certain courses they could be
> > doing.
>
> > > Then the other thing I want to do is set a date and time for each
> > > course. So would I create this also:
>
> > > class CourseDate
> > >   belongs_to :course
> > > end
>
> > > class CourseTime
> > >   belongs_to :coursedate
> > > end
>
> > Without a full understanding of your problem (perhaps you are managing
> > repeating occurrences of courses etc.) this feels a little overkill to
> > be honest. would date/time columns on your courses table not suffice?
>
> > Fred
>
> > > Thanks in advance, Mark

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



[Rails] Re: How can I disable Rails 3.1's ActiveRecord Query Caching?

2011-08-07 Thread Frederick Cheung


On Aug 7, 5:55 am, Phoenix Rising  wrote:
> Hey guys,
>
> As most of you know, Rails 3.1 introduces query caching for
> ActiveRecord.  Great change all-in-all, but for those of us with IT
> department mandates for using MySQL (yeah, yeah, I know...), it's kind
> of a mixed bag.
>
> I need to disable query caching in a project I'm building based on
> 3.1.  I've tried a couple different approaches, both without any
> success.  I was hoping some one could enlighten me on how to do that,
> exactly.
>
> The first approach I tried was to create an initializer (config/
> initializer/active_record.rb) and include this code:
> ActiveRecord::Base.connection.disable_query_cache!
>
> (Documented 
> athttp://edgeapi.rubyonrails.org/classes/ActiveRecord/ConnectionAdapter...
> without comments or examples, unsurprisingly).
>
> This doesn't appear to work as I'm still seeing prepared statement
> caching going on in my log file:
> Started GET "/dashboard" for 127.0.0.1 at 2011-08-06 22:43:07 -0600
>   Processing by DashboardController#index as HTML
>   User Load (13.4ms)  SELECT "users".* FROM "users" WHERE "users"."id"
> = $1 LIMIT 1  [["id", 1]]
> Rendered dashboard/index.html.erb within layouts/application (0.3ms)
>   CACHE (0.0ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1
> LIMIT 1
>
> So my next attempt was to place it in config/environments/
> development.rb (I'm of course trying to get this to work in
> development mode before doing it in production, obviously):
>
> MyApp::Application.configure do
>   # ... other stuff ...
>   config.active_record.disable_query_cache!
> end
>
> Same deal.  I tried also changing that to
> config.active_record.cache_queries = false - no such luck (and that
> was just a long shot guess).
>
> Can anyone explain to me exactly how I'm supposed to turn this off?
> Thanks.

The ActiveRecord::QueryCache middleware turns on query caching during
for each request. Remove it from the middleware stack and you should
be ok ( http://guides.rubyonrails.org/configuring.html#configuring-middleware
)

Fred

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



Re: [Rails] Re: Re: Accessing datetime elements from hash passed to method

2011-08-07 Thread Colin Law
On 6 August 2011 22:57, Jarek Plonski  wrote:
>> Well, you lied.  You didn't have a Date, you had a String.
>
> I'm not saying that I know what I'm talking about :)
>
>  I'm newbie but I didn't lie.
>
> What I said was:
> "...date as a value (taken from
> datetime_select helper)"
>
> if it was a String then datetime_select returns a string, or Dates are
> Strings but with some order.
>
> I'm getting confused now.

I think values in params hash are always strings as they are just the
strings taken from the http request.  As you said, you never said that
you had a Date object.

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