Hello frnds I want to access the variables of view in my controller.. What i want to do is that the value that i m storing in view i want to store that thru a variable by defining it in the controller.. is that possible? Please reply 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 7 Oct 2007, at 13:47, Dhaval Parikh wrote:> > Hello frnds > > I want to access the variables of view in my controller.. What i > want to > do is that the value that i m storing in view i want to store that > thru > a variable by defining it in the controller.. >That doesn''t really make sense since usually the rendering of the view happens after the controller code has executed. Views magically get instance variables defined in the controller, but that doesn''t happen in the reverse direction. Fred> is that possible? > > Please reply > > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
hi thanks for ur reply i will tell you the whole situation and after that u suggest me the best method.. say i have a table which i m generating some how...now i want to match the email condition which i have done by using .match in view and storing that in @email variable...like that i m fetching 2-3 things form that table..which im storing in individual variables.. now i want to store the value of that variable into a new table in the appropriate column...remember i m currently doing this in view which lead me to ask you this question... i know that the samething can be done in controller but then what about the .match condition it doesnt work in the controller..and i m not getting any other solution apart from doing this..i m getting the desired result in my list page but those values i want to store in the database... can u pls guide me how can i do the same thanks dhaval parikh -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 8 Oct 2007, at 08:34, Dhaval Parikh wrote:> > hi thanks for ur reply i will tell you the whole situation and after > that u suggest me the best method.. > > > say i have a table which i m generating some how...now i want to match > the email condition which i have done by using .match in view and > storing that in @email variable...like that i m fetching 2-3 things > form > that table..which im storing in individual variables.. now i want to > store the value of that variable into a new table in the appropriate > column...remember i m currently doing this in view which lead me to > ask > you this question... >This is still rather vague, but anyway the answer is ''Stop doing too much in the view''. Theres no good reason to do stuff like that in the view. 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
wat you are saying is perfect but the main issue is that i dont find any other way out for doing the same..i mean matching the email condition in the controller -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 8 Oct 2007, at 09:34, Dhaval Parikh wrote:> > wat you are saying is perfect but the main issue is that i dont > find any > other way out for doing the same..i mean matching the email > condition in > the controllerNo one can guess what it is you''re doing without seing any code. 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
<% for aggregator_item in @aggregator_items %> <% if @desc = aggregator_item.send("description").match(/\S+@\S+\.[a-zA-Z0-9]{1,}/) %> <br /><% @timestamp = aggregator_item.send("timestamp") %> <br /><%=h @link = aggregator_item.send("link") %> <br /><%=h @desc%> <br /><%=h @title = aggregator_item.send("title")%> <br /><%= Time.at(@timestamp) %> <% "insert into email(mail,subject,source) VALUES (''@desc[:email]'',''@link[:source]'',''@title''[:subject])"; %> <br /> <% end %> <% end %> this is the code im using now the values of @desc,@link and @title i want to put it into the database..now can you tell me wat can i do?? -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
in the above code <% "insert into email(mail,subject,source) VALUES (''@desc[:email]'',''@link[:source]'',''@title''[:subject])"; %> is used for inserting th evalues into the db this is wat i m stuck with..how to do it with the help of controller.. ofcourse the above code i m writing in views which i dont want to do -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 8 Oct 2007, at 10:11, Dhaval Parikh wrote:> > <% for aggregator_item in @aggregator_items %> > > > <% if @desc > aggregator_item.send("description").match(/\S+@\S+\.[a-zA-Z0-9] > {1,}/) %> > > <br /><% @timestamp = aggregator_item.send("timestamp") %> > <br /><%=h @link = aggregator_item.send("link") %> > <br /><%=h @desc%> > <br /><%=h @title = aggregator_item.send("title")%> > <br /><%= Time.at(@timestamp) %> > <% "insert into email(mail,subject,source) VALUES > (''@desc[:email]'',''@link[:source]'',''@title''[:subject])"; %> > > <br /> > > > <% end %> > <% end %> > >You could very easily have all of this in a model. The model would insert them into the database, (why are you using sql rather than the corresponding ActiveRecord class?) and return an array of these activerecord objects, which you would iterate over in the view. Fred> this is the code im using now the values of @desc,@link and @title i > want to put it into the database..now can you tell me wat can i do?? > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
can you tell me how do i write the same thing in 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 8 Oct 2007, at 10:42, Dhaval Parikh wrote:> > can you tell me how do i write the same thing in model/?It''s pretty much what you''ve got in your view - iterate over your aggregator objects, pull out the values you want and pass them to Email.create Fred> -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
ya did that too but stuck with the insert query can you tell me the exact query which i will use to insert records into the database...in another table (note i m fetching values from one table and I need to store that in another table) i will have to insert the value of variable @email into the specified email column..but it would be gr8 if u tell me the exact syntex for the same.. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 8 Oct 2007, at 11:40, Dhaval Parikh wrote:> > ya did that too but stuck with the insert query can you tell me the > exact query which i will use to insert records into the database...in > another table > (note i m fetching values from one table and I need to store that in > another table) > > i will have to insert the value of variable @email into the specified > email column..but it would be gr8 if u tell me the exact syntex for > the > same..Don''t write sql. Do use activerecord. if you''re inserting to the emails table then it''s just Email.create, passing the desired attributes as a hash. 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---