manish belsare | 1 Aug 09:25
Picon

Invitation to connect on LinkedIn

LinkedIn

I'd like to add you to my professional network on LinkedIn.

- manish

manish belsare
Student at Pune Institute of Computer Technology
Pune Area, India

Confirm that you know manish

© 2011, LinkedIn Corporation

_______________________________________________
Engine-Users mailing list
Engine-Users@...
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org
manishbelsare2003 | 1 Sep 20:55
Picon

Message from manishbelsare2003

If you are unable to view this mailer properly, please click here
manishbelsare2003 (manishbelsare2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org) thinks you would love this simple scheme to Get a FREE T-shirt!
Hey,

Here is a sure shot way of getting a Free T-shirt! Read on to know more and please do join to help me get my Free Tee!

Cheers,

manishbelsare2003

Inkfruit.com is a community of artists making some amazing T-shirts! And we have an offer you just can't refuse!
If you register 10 friends through you, you get a Free T-shirt! All your friends also get Rs50 OFF for joining through you!

Please Join to Help manishbelsare2003 get a Free T-shirt. You will also get Rs50 OFF on first purchase + You can also win a Free Tee by inviting friends!



www.inkfruit.com
To Unsubscribe click here | Privacy Policy
 
engine-users-ETbvJ2rUIr5Yl5lBQYSteqFQy8kfjZ21@public.gmane.org was invited to visit Inkfruit by manishbelsare2003.
Inkfruit's offices are located at 100/795, Motilal Nagar, Goregaon. Mumbai. India.
_______________________________________________
Engine-Users mailing list
Engine-Users@...
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org
manish belsare | 25 Aug 14:25
Picon

Sonia Gandhi

Hi,

Soon all of us will be eating genetically contaminated food. The Cabinet has just approved the Biotechnology Regulatory Authority of India (BRAI) bill which will allow genetically modified food into the country. The bill can be tabled in the Parliament anytime.

The BRAI will be a body of technocrats whose decisions will remain unquestioned. Our state governments and people like us will not be able to question this body.

To stop this, Greenpeace, a civil society organisation working on varied issues including sustainable agriculture, is sending an open letter to the National Advisory Council (NAC) Chairperson Mrs Sonia Gandhi. The letter asks her to make the Government re-draft this bill after consulting the public. I have already signed this letter and more signatures will make the case stronger.

Can you also sign this letter to Sonia Gandhi?

www.greenpeace.in/safefood/change-brai-bill-stop-gm-food-india/

Thanks!

manishbelsare2003-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

You are receiving this email because someone you know sent it to you from the Greenpeace site. Greenpeace retains no information about individuals contacted through its site, and will not send you further messages without your consent -- although your friends could, of course, send you another message.

_______________________________________________
Engine-Users mailing list
Engine-Users@...
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org
Michael Rigart | 1 Aug 17:51
Picon

Engine routes

Hi all,

I have a small question regarding Rails 3 / engines en routes file.

At this point, I start my routes file with the following line:

Rails.application.routes.draw do |map|

But, since Rails 3 RC 1, I got deprecation warnings in my app saying
that Rails.application will become deprecated, using
ProjectName::Application instead, but also that you need to drop the
|map| parameter.

Now, that is in a project, but what about engines? Since engines are
small sub applications that can be used in multiple apps, you can't just
use Projectname::Application.

Any comments on this issue?
--

-- 
Posted via http://www.ruby-forum.com/.
Michael Rigart | 31 Jul 19:54
Picon

Re: Rails 3 Engines

thx, just got it ;). stupid question . Thx for the hint though. My 
earlier solution broke down when upgrading from Beta4 to RC1
--

-- 
Posted via http://www.ruby-forum.com/.
Michael Rigart | 31 Jul 19:43
Picon

Re: Rails 3 Engines

Hi Matt,

where exactly do you put that initializer?

--

-- 
Posted via http://www.ruby-forum.com/.
Didier Did | 17 Jun 14:36
Picon
Gravatar

Re: Rails 3 Engines

> Anyway, nice working with you Didier to get working and dynamic solution 
> for this problem.

Thanks ! Same thing :-)
--

-- 
Posted via http://www.ruby-forum.com/.
Didier Did | 17 Jun 13:11
Picon
Gravatar

Re: Rails 3 Engines

> Well, with my method it seemed like it was needed.

That's right but how can your engine know what helpers are not tied to 
controllers ? mmmhh, that's definitely doable but it's not worth it.

> I tryed your way, but it doesn't seem to work.

I think that's because of namespacing. It expects Admin::MediasHelper 
but that's weird since you call it from your Admin module.
Maybe you should try to force it ?

ActionController::Base.helper "admin/#{File.basename(file, '.rb')
".camelize.constantize

I'm thinking, maybe you could have the best of the two worlds.

%w{metas categories themes}.each do |name|
  ActionController::Base.helper 
"Admin::#{name.camelize}Helper".constantize
end

What do you think about it ?

> 
>
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/inflector/methods.rb:103:in 
> `constantize': uninitialized constant MediasHelper (NameError)
> 
> Even when I add the loadpaths
> 
>   module Admin
>       ActiveSupport::Dependencies.load_paths << File.dirname(__FILE__) + 
> "/../app/helpers"
>       Dir[File.dirname(__FILE__) + 
> "/../app/helpers/**/*_helper.rb"].each do |file|
>           ActionController::Base.helper File.basename(file, 
> '.rb').classify.constantize
>       end
>   end
> 
> 
> 
> Didier Did wrote:
>> Your solution looks good ! Are you sure that even your first statement 
>> (ActiveSupport::Dependencies.load_paths...) is needed ?
>> 
>> 
>>> What I'm woundering now is if It's possible to load all helpers without 
>>> specifying them individualy
>> 
>> Something like that ?
>> 
>> module Admin
>>   # adjust path
>>   Dir[File.dirname(__FILE__) + "/../../helpers/**/*_helper.rb"].each do
>> |file|
>>      ActionController::Base.helper File.basename(file, 
>> '.rb').classify.constantize
>>   end
>> end

--

-- 
Posted via http://www.ruby-forum.com/.
Didier Did | 17 Jun 12:18
Picon
Gravatar

Re: Rails 3 Engines

Your solution looks good ! Are you sure that even your first statement 
(ActiveSupport::Dependencies.load_paths...) is needed ?

> What I'm woundering now is if It's possible to load all helpers without 
> specifying them individualy

Something like that ?

module Admin
  # adjust path
  Dir[File.dirname(__FILE__) + "/../../helpers/**/*_helper.rb"].each do
|file|
     ActionController::Base.helper File.basename(file, 
'.rb').classify.constantize
  end
end

--

-- 
Posted via http://www.ruby-forum.com/.
Didier Did | 17 Jun 11:20
Picon
Gravatar

Re: Rails 3 Engines

> could you tell me how to include those helpers from my engine? I have 
> tried several methods like
> 
>       class Engine < Rails::Engine
>           config.to_prepare do
>               ApplicationController.helper(Admin::MetasHelper)
>           end
>       end
> 

I spent some much time on this, trying all the different ways of 
including those helpers (ie not related to controllers), without any 
success (sometimes it worked in dev env but not in prod, ...etc).
So I came up with another approach.
Actually, my engine controllers inherit from a base controller. So 
inside this base one, I added the following lines:

Dir[File.dirname(__FILE__) + "/../../helpers/**/*_helper.rb"].each do 
|file|
   helper "admin/#{File.basename(file, '.rb').gsub(/_helper$/, '')}"
end

Even if it is not super clean, it does the trick for me. If anyone has a 
better way of doing it, let me know :-)

> Secondly, I allready knew that accessing assets from gems would be 
> impossible. The only difference was, that I thought that their might be 
> a special helper like the rails_engine plugin for Rails 2.x .
> But just for the info, how do I access files from my gem/engine? When I 
> create a generator, how does the filepath usualy work?

Take a look at my generator:

http://github.com/did/locomotive/blob/master/lib/generators/locomotive/assets/assets_generator.rb

--

-- 
Posted via http://www.ruby-forum.com/.
Mathew Augustine | 31 Mar 06:34
Picon

application to import a csv file to database(help me)


hi actually i am creating an application to import a csv file to
database. but onn running that application ai'am getting errors like
this

NoMethodError in ImportsController#new

undefined method `login_required' for #<ImportsController:0xb6d84b5c>

and this error too


Processing ImportsController#new (for 127.0.0.1 at 2010-03-31 09:38:19)
[GET]

NoMethodError (undefined method `login_required' for
#<ImportsController:0xb6d03f70>):



ma controller is here



class ImportsController < ApplicationController
before_filter :login_required #protect controller from anonymous users

def new
<at> import = Import.new
end

def create
<at> import = Import.new(params[:import])

respond_to do |format|
if <at> import.save!
flash[:notice] = 'CSV data was successfully imported.'
format.html { redirect_to( <at> import) }
else
flash[:error] = 'CSV data import failed.'
format.html { render :action => "new" }
end
end
end

def show
<at> import = Import.find(params[:id])
end

def proc_csv
<at> import = Import.find(params[:id])
lines = parse_csv_file( <at> import.csv.path)
lines.shift #comment this line out if your CSV file doesn't contain
a header row
if lines.size > 0
<at> import.processed = lines.size
lines.each do |line|
case <at> import.datatype
when "releases"
new_release(line)
end
end
<at> import.save
flash[:notice] = "CSV data processing was successful."
redirect_to :action => "show", :id => <at> import.id
else
flash[:error] = "CSV data processing failed."
render :action => "show", :id => <at> import.id
end
end

private

def parse_csv_file(path_to_csv)
lines = []

#if not installed run, sudo gem install fastercsv
#http://fastercsv.rubyforge.org/
require 'fastercsv'

FasterCSV.foreach(path_to_csv) do |row|
lines << row
end
lines
end

def new_release(line)
params = Hash.new
params[:release] = Hash.new
params[:release]["title"] = line[0]
params[:release]["rdate"] = line[1]
params[:release]["body"] = line[3]
params[:release]["notes"] = line[4]
release = Release.new(params[:release])
release.save
end

end

this is ma model


class Import < ActiveRecord::Base
# Paperclip
has_attached_file :csv
validates_attachment_presence :csv
validates_attachment_content_type :csv, :content_type =>
['text/csv','text/comma-separated-values','text/csv','application/csv','application/excel','application/vnd.ms-excel','application/vnd.msexcel','text/anytext','text/plain']
end


anyone pls help me
_______________________________________________
Engine-Users mailing list
Engine-Users@...
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org

Gmane